Skip to main content
  1. CTF Writeups/
  2. IrisCTF 2025/

No Shark

·
Net 50pt Tcp
subzcuber
Author
subzcuber
i like to imagine i’m funny
Table of Contents

Points: 50

Where’s baby shark at?

Author: skat


We were given the text in noshark.txt. At first sight it feels obvious that these are raw packets. We just have to interpret them. Now I didn’t know enough about networks to properly read the packets, so I asked chatgpt for help. From there I extracted the data packets which turned out to be an image that gave us the flag.

However I would now like to actually understand the packets in depth.

I found this fantastic read that really breaks down the structure of a packet.

Packets are constructed in such a way that layers in each protocol are wrapped around each other. So our first layer would be the Network Access Layer or the Ethernet Layer.

Network Access Layer
#

Field NameSizeDescription
Destination MAC6 bytesThe MAC address of the frame’s recipient.
Source MAC6 bytesThe MAC address of the frame’s sender.
EtherType2 bytesIndicates the type of payload.
PayloadVariableContains the encapsulated protocol data.
Frame Check Sequence4 bytesEnsures data integrity.

as we can see our type is 0800 which says the internal packet is an IPv4 packet

EtherTypeProtocolDescription
0800IPv4Internet Protocol version 4
0806ARPAddress Resolution Protocol
86DDIPv6Internet Protocol version 6
8847MPLSMultiprotocol Label Switching (unicast)
8100VLAN-tagged frameIndicates a VLAN-tagged frame (802.1Q)

0000000000000000000000000800 so our packet breaks into

DestinationSourceType/LengthDataCRC32
0000 0000 0000 00000000 0000 0000 00000800--

After the Network Acess Layer we have the Internet Layer which as we know from the type above is IPv4

Internet Layer
#

Field NameSize
Version4 bits
HLEN4 bits
Type of Service1 byte
Total Length2 bytes
Identification2 bytes
Flags3 bits
Fragment Offset13 bits
Time to Live2 bytes
Protocol1 byte
Header Checksum2 bytes
Source IP4 byte
Destination IP4 byte
Options0-40 bytes
Data

4500 003c 7d15 4000 4006 bfa4 7f000001 7f000001

The Protocol byte is 06 which means that the next packet is TCP

Protocol NumberProtocol NameDescription
01ICMPInternet Control Message Protocol
02IGMPInternet Group Management Protocol
06TCPTransmission Control Protocol
11UDPUser Datagram Protocol
29IPv6-RouteRouting Header for IPv6
84SCTPStream Control Transmission Protocol

The full list can be found in IANA’s Protocol Numbers registry.

Transport Layer
#

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |          Source Port          |       Destination Port        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                        Sequence Number                        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                    Acknowledgment Number                      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |  Data |       |C|E|U|A|P|R|S|F|                               |
   | Offset| Rsrvd |W|C|R|C|S|S|Y|I|            Window             |
   |       |       |R|E|G|K|H|T|N|N|                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |           Checksum            |         Urgent Pointer        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                           [Options]                           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               :
   :                             Data                              :
   :                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

First we have the TCP Header. The data offset and flags are usually the most important. We also have some options.

However in the end the main thing we want is the data, which we can extract with the very simple solve.py to get the image

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
with open("./noshark.txt", "r") as packets:
    lines = packets.readlines()
    img_data = ""
    OFFSET = len(lines[2]) - 1
    for line in lines:
        if len(line) > len(lines[0]):
            img_data += line[OFFSET:] 

    bytedata = bytes.fromhex(img_data)
    with open("image.jpg", "wb") as imgfile:
        if imgfile.write(bytedata):
            print("suzzess")

flag


irisctf{welcome_to_net_its_still_ez_to_read_caps_without_wireshark}
Reply by Email

Related

Password Manager
Web 50pt Path Traversal
path traversal is blocked, or is it?
Sqlate
Pwn 50pt Bof
silly hex conversion
deldeldel
For 50pt Usb Hid Wireshark
usb hid data