Writeup · 31 Nights of Root

BlackGate Watch

forensicseasysolvedFlag: r00t{REDACTED}

Overview

An incident was discovered and some logs were captured. Can you dig through them and uncover details?

We are provided with a packet capture:

dns_tunnel.pcap

The filename itself is an important clue: dns_tunnel.pcap.

The objective is to inspect the network traffic, identify suspicious activity, reconstruct the data that was exfiltrated, and recover the flag.

Prerequisites / Setup

  • tshark (or Wireshark)
  • xxd / printf for hex decoding
  • dns_tunnel.pcap in the working directory

Recon

Step 1 — Identify the capture file

Goal: Confirm the artifact is a standard PCAP.

file dns_tunnel.pcap
dns_tunnel.pcap: pcap capture file, microsecond ts (little-endian) - version 2.4 (Ethernet, capture length 65535)

Interpretation: The artifact is a standard PCAP packet capture, so Wireshark, tshark, or other packet-analysis tools apply.

Step 2 — Inspect the protocol hierarchy

Goal: Determine what protocols are present.

tshark -r dns_tunnel.pcap -q -z io,phs

Relevant output:

Protocol Hierarchy Statistics
===================================================================
frame                                    frames:3686 bytes:334182
  eth                                    frames:3686 bytes:334182
    arp                                  frames:240 bytes:10080
    ip                                   frames:3446 bytes:324102
      udp                                frames:1366 bytes:126163
        dns                              frames:1306 bytes:120763
        ntp                              frames:60 bytes:5400
      tcp                                frames:2080 bytes:197939
        tls                              frames:511 bytes:111805
        data                             frames:9 bytes:1894

There are:

  • 3,686 total Ethernet frames
  • 1,306 DNS frames
  • 2,080 TCP frames
  • 511 TLS frames
  • Various ARP and NTP traffic

Interpretation: The large amount of DNS traffic is immediately interesting because the challenge is called dns_tunnel.pcap — DNS may be the exfiltration channel.

Step 3 — Inspect DNS queries

Goal: Extract DNS query names and spot anomalies.

tshark -r dns_tunnel.pcap -Y 'dns.qry.name' \
  -T fields -e frame.number -e dns.qry.name

Most of the traffic looks completely normal:

outlook[.]office365[.]com
api[.]slack[.]com
drive[.]google[.]com
cdn[.]jsdelivr[.]net
s3[.]amazonaws[.]com
fonts[.]googleapis[.]com
zoom.us
github.com
graph[.]microsoft[.]com
teams[.]microsoft[.]com

This establishes a background of apparently legitimate DNS traffic.

However, there are three unusual queries:

000[.]723030747b646e735f74756e6e336c73[.]relay[.]blackgate-watch[.]net
001[.]5f63347272795f6d3072335f7468346e[.]relay[.]blackgate-watch[.]net
002[.]5f717533723133737d[.]relay[.]blackgate-watch[.]net

These are clearly different from the normal DNS traffic.

Exploitation

Step 4 — Identify the suspicious domain

Goal: Confirm the domain used for exfiltration.

The suspicious domain is:

relay[.]blackgate-watch[.]net

This is particularly interesting because the challenge itself is named BlackGate Watch.

The three queries have the following structure:

000.<payload>.relay[.]blackgate-watch[.]net
001.<payload>.relay[.]blackgate-watch[.]net
002.<payload>.relay[.]blackgate-watch[.]net

This strongly resembles a DNS tunneling mechanism.

The numerical prefixes:

000
001
002

are likely sequence numbers. The long middle labels are likely encoded data.

Step 5 — Extract the payload

Goal: Confirm the payloads are hex-encoded.

The three suspicious payloads:

723030747b646e735f74756e6e336c73
5f63347272795f6d3072335f7468346e
5f717533723133737d

They contain only hexadecimal characters:

0-9
a-f

This is a strong indication that the data is hexadecimal encoded.

Step 6 — Decode the chunks

Goal: Decode each hex chunk.

First chunk:

printf '%s' '723030747b646e735f74756e6e336c73' | xxd -r -p
r00t{dns_tunn3ls

Second chunk:

printf '%s' '5f63347272795f6d3072335f7468346e' | xxd -r -p
_c4rry_m0r3_th4n

Third chunk:

printf '%s' '5f717533723133737d' | xxd -r -p
_qu3r13s}

Step 7 — Reassemble the chunks

Goal: Order by sequence number and concatenate.

The sequence numbers tell us the correct order:

000 → first chunk
001 → second chunk
002 → third chunk
r00t{dns_tunn3ls
_c4rry_m0r3_th4n
_qu3r13s}

Concatenating the chunks:

r00t{REDACTED}

Flag

r00t{REDACTED}

Recovered by decoding and reassembling the three hex-encoded DNS tunneling payloads.

Lessons / Takeaways

  • A DNS hostname can be used as a transport mechanism — inspect unusual subdomains and long middle labels.
  • Hex encoding allows arbitrary text to be transported through a DNS label.
  • Sequence numbers in query names let you reassemble split payloads in order.
  • Compare against a background of legitimate traffic: the three suspicious queries stood out against normal SaaS/CDN DNS queries.

Mitigations

  • Monitor DNS query volume and label length/entropy per domain; long hex-like labels on a single dedicated domain are a tunneling indicator.
  • Restrict outbound DNS to trusted resolvers and log query names for analysis.
  • Use DNS tunneling detection (e.g., unusual qname length, high NXDOMAIN rates, single-client query bursts).

Techniques

References