Rating:

![image](https://user-images.githubusercontent.com/87527216/214194810-d79e3d23-9d1c-41d9-b1e4-1ae0cff69933.png)

I figured out that there is no FLAG in the sea.jpg file. The file size seems to be too large compared to the contents of the file, so I analyzed it through binwalk

![image](https://user-images.githubusercontent.com/87527216/214194830-90b4c768-0ac4-492e-b039-4dfdd137b292.png)

I confirmed that there was a zip file, proceeded with file carving, and unzipped it.

![image](https://user-images.githubusercontent.com/87527216/214194862-fa69bb51-b8cd-4d25-a90a-5b5c46133788.png)

There was a deep file in the compressed file, and I opened the file with notepad. JFIF, IDHR, sRGB, and gAMA stood out, and it was found that the PNG file caused an error in recognizing the file through the header signature in JFIF.
I changed the extension to png to use pngcheck.

![image](https://user-images.githubusercontent.com/87527216/214194900-625a5902-199a-4f5b-8556-1a0399c0bbb9.png)

However, it was not possible to confirm. Changed the file header signature to PNG header signature through HxD.

![image](https://user-images.githubusercontent.com/87527216/214194940-b89f5fde-c2a9-4c0f-9396-eaa1d20b1e87.png)

![image](https://user-images.githubusercontent.com/87527216/214194960-d1de85aa-6d92-4aad-ae55-7d4c61d93429.png)

![image](https://user-images.githubusercontent.com/87527216/214194976-b8cea19b-e3a7-49bc-bcf4-a52146b1061d.png)

changed it, but the image seems to be cut off, so I programmed a python code that changes the width and height to fit the crc.
The programming code below goes from carving a file to changing the height and width to match the crc value and displaying the image

```python
from zipfile import *
from zlib import crc32
from struct import pack
from tkinter import *

data = open("sea.jpg","rb").read()[0x8D19BF:]

# file caving
open("flag.zip","wb").write(data)

zip = ZipFile("./flag.zip","r").extractall("./")

with open("deep","rb") as f:
deep = bytearray(f.read())
deep[0:0xA] = b"\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00"

ihdr = bytearray(deep[0xC:0x1D])
crc = int.from_bytes(deep[0x1D:0x21],"big")
#crc checker
for x in range(1,2000):
height = pack('i',x)[::-1]
for y in range(1,4000):
width = pack('i',y)[::-1]
ihdr[8:12] = height
ihdr[4:8] = width

if crc32(ihdr) == crc:
deep[0xC:0x1D]=ihdr
open('flag','wb').write(deep)

root= Tk()
img = PhotoImage(file="flag")
Label(root,image=img).pack()
root.mainloop()
exit()
```

The result of running the above code showed an image with a flag

![image](https://user-images.githubusercontent.com/87527216/214195044-01e68d03-c4a0-45a6-8c8a-79e0b6ac3c61.png)

FLAG : ```KCTF{g0_d33p_d0wn}```