One surgical procedure for the ethical hacker is to use scalpel
to fix tunn3l v1s10n.
In the /etc/scalpel/scalpel.conf
configuration file of the scalpel
tool, uncomment the following line:
# bmp y 100000 BM??\x00\x00\x00
- download
tunn3l_v1s10n
and rename it totunn3l_v1s10n.bmp
after confirming that the first two bytes are42 4d
(BM
), using a hex editor - copy
tunn3l_v1s10n.bmp
to an empty sub-directory - set first 7 bytes of
tunn3l_v1s10n.bmp
to 42 4d 3f 3f 00 00 00, using a hex editor - pass
tunn3l_v1s10n.bmp
as an argument toscalpel
inroot
user mode
# scalpel tunn3l_v1s10n.bmp
Scalpel version 1.60
Written by Golden G. Richard III, based on Foremost 0.69.
Opening target "/home/kali/Desktop/tunn3l-v1s10n/bmp_file/tunn3l_v1s10n.bmp"
Image file pass 1/2.
tunn3l_v1s10n.bmp: 100.0% |****************************************************| 2.8 MB 00:00 ETAAllocating work queues...
Work queues allocation complete. Building carve lists...
Carve lists built. Workload:
bmp with header "\x42\x4d\x3f\x3f\x00\x00\x00" and footer "" --> 1 files
Carving files from image.
Image file pass 2/2.
tunn3l_v1s10n.bmp: 100.0% |****************************************************| 2.8 MB 00:00 ETAProcessing of image file complete. Cleaning up...
Done.
Scalpel is done, files carved = 1, elapsed = 0 seconds.
42 4d 8e 26 2c 00 00 00 00 00 ba d0 00 00 ba d0 00 00 6e 04 00 00 32 01 00 00 01 00 18 00 00 00
(corrupted bytes)42 4d 3f 3f 00 00 00 00 00 00 36 00 00 00 28 00 00 00 6e 04 00 00 42 03 00 00 01 00 18 00 00 00
(afterscalpel
)
- first bytes
ba d0
were changed to36 00
- second bytes
ba d0
were changed to28 00
- bytes
32 01
were changed to42 03
- hex
36
indicates that 54 bytes equals 14-byte-long file header plus 40-byte-long info header - hex
28
indicates a 40 byte-long BMP info header 42
and03
affect the offsets of the image, as I understand it.
Thanks to the precise efficiency of scalpel
, the picoCTF flag pops at the top of the image:
picoCTF{qu1t3_a_v13w_2020}
- picoCTF 2021 tunn3l v1s10n
- tunn3l v1s10n.md
- The Paleotechnologist: BMP file format
- Wikipedia: BMP file format: Bitmap file header
- ImageMagick
- [N] Curses Hexedit
- How to make a BMP image in a text editor
- CS Principles: Unit 1 Day 5: Bitmaps encoding and decoding
- CIT2553 Lab 2 Recovering BMP Files and Little Endian
- How to Make a Windows BMP File from a Hex Editor
- ASCII Table