3D

Challenge

The robots appear to be testing some kind of new camera technology but we haven't quite figured it out yet. Understanding this imaging could be crucial to our understanding the enemy and winning the war. http://ctf.plaidctf.com/media/files/3d-4e5132069964e0d61c0fbd9099dea498/edbd4701d0b9d2a33a743e96f7bc8f3b

Walkthrough

We quickly downloaded the image file and opened it up in our favorite image viewer (Preview -- because I can just hit spacebar! :). The image looks like a computer screen showing gedit open with the key typed in. However, a piece of paper is held in the way. Since the challenge is called 3D, we expected the file to be stereoscopic. We quickly try to open it on a 3D capable Android phone, no luck. It was the wrong format.

Well, what's the first thing we do with an image? We run it through exiftool!

~/ctf/pct/3d/ $ exiftool edbd4701d0b9d2a33a743e96f7bc8f3b 
ExifTool Version Number         : 8.59
File Name                       : edbd4701d0b9d2a33a743e96f7bc8f3b
Directory                       : .
File Size                       : 6.0 MB
File Modification Date/Time     : 2012:04:27 07:32:14-04:00
File Permissions                : rw-r--r--
File Type                       : JPEG
MIME Type                       : image/jpeg
Exif Byte Order                 : Little-endian (Intel, II)
Image Description               : 
Make                            : SONY
Camera Model Name               : DSC-HX9V
Orientation                     : Horizontal (normal)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Modify Date                     : 2012:04:04 11:32:05
Y Cb Cr Positioning             : Co-sited
Exposure Time                   : 1/125
F Number                        : 3.3
Exposure Program                : Program AE
ISO                             : 200
Sensitivity Type                : Recommended Exposure Index
Recommended Exposure Index      : 200
Exif Version                    : 0230
Date/Time Original              : 2012:04:04 11:32:05
Create Date                     : 2012:04:04 11:32:05
Components Configuration        : Y, Cb, Cr, -
Compressed Bits Per Pixel       : 1
Brightness Value                : 4.3609375
Exposure Compensation           : 0
Max Aperture Value              : 3.3
Metering Mode                   : Multi-segment
Light Source                    : Unknown
Flash                           : Off, Did not fire
Focal Length                    : 4.3 mm
Panorama Full Width             : 1920
Panorama Full Height            : 1080
Panorama Direction              : Left to Right
Panorama Crop Left              : 0
Panorama Crop Top               : 0
Panorama Crop Right             : 1920
Panorama Crop Bottom            : 1080
Panorama Frame Width            : 1920
Panorama Frame Height           : 1080
Panorama Source Width           : 1784
Panorama Source Height          : 1004
Brightness                      : 0
High ISO Noise Reduction        : n/a
HDR                             : Off
Face Info Offset                : 94
Sony Date Time                  : 2012:04:04 11:32:05
Faces Detected                  : 0
Face Info Length                : 37
Color Reproduction              : Standard
Scene Mode                      : n/a
Zone Matching                   : ISO Setting Used
Image Stabilization             : Unknown (4294967295)
Macro                           : Off
Focus Mode                      : Permanent-AF
AF Mode                         : Default
AF Illuminator                  : Off
Quality                         : Fine
Flash Level                     : Unknown (128)
Release Mode                    : Normal
Sequence Number                 : Single
Long Exposure Noise Reduction   : Unknown (2)
Dynamic Range Optimizer         : Off
Intelligent Auto                : Off
White Balance                   : Auto
User Comment                    : 
Flashpix Version                : 0100
Color Space                     : sRGB
Exif Image Width                : 1920
Exif Image Height               : 1080
Interoperability Index          : R98 - DCF basic file (sRGB)
Interoperability Version        : 0100
File Source                     : Digital Camera
Scene Type                      : Directly photographed
Custom Rendered                 : Normal
Exposure Mode                   : Auto
Scene Capture Type              : Standard
Contrast                        : Normal
Saturation                      : Normal
Sharpness                       : Normal
Lens Info                       : 4.28-68.48mm f/3.3-5.9
GPS Version ID                  : 2.3.0.0
GPS Status                      : Measurement Void
GPS Img Direction Ref           : Magnetic North
GPS Img Direction               : 81
GPS Map Datum                   : WGS-84
GPS Differential                : No Correction
PrintIM Version                 : 0300
Compression                     : JPEG (old-style)
Thumbnail Offset                : 13618
Thumbnail Length                : 5020
Number Of Images                : 15
MP Image Flags                  : (none)
MP Image Format                 : JPEG
MP Image Type                   : Multi-frame Disparity
MP Image Length                 : 373993
MP Image Start                  : 5960192
Dependent Image 1 Entry Number  : 0
Dependent Image 2 Entry Number  : 0
Total Frames                    : 15
MPF Version                     : 0100
MP Individual Num               : 1
Base Viewpoint Num              : 8
Convergence Angle               : 1
Baseline Length                 : 1
Image Width                     : 1920
Image Height                    : 1080
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:2 (2 1)
Aperture                        : 3.3
Image Size                      : 1920x1080
MP Image 2                      : (Binary data 381309 bytes, use -b option to extract)
MP Image 3                      : (Binary data 376878 bytes, use -b option to extract)
MP Image 4                      : (Binary data 374914 bytes, use -b option to extract)
MP Image 5                      : (Binary data 374557 bytes, use -b option to extract)
MP Image 6                      : (Binary data 374987 bytes, use -b option to extract)
MP Image 7                      : (Binary data 375239 bytes, use -b option to extract)
MP Image 8                      : (Binary data 376199 bytes, use -b option to extract)
MP Image 9                      : (Binary data 377134 bytes, use -b option to extract)
MP Image 10                     : (Binary data 378356 bytes, use -b option to extract)
MP Image 11                     : (Binary data 379828 bytes, use -b option to extract)
MP Image 12                     : (Binary data 378485 bytes, use -b option to extract)
MP Image 13                     : (Binary data 377924 bytes, use -b option to extract)
MP Image 14                     : (Binary data 374779 bytes, use -b option to extract)
MP Image 15                     : (Binary data 373993 bytes, use -b option to extract)
Shutter Speed                   : 1/125
Thumbnail Image                 : (Binary data 5020 bytes, use -b option to extract)
Focal Length                    : 4.3 mm
Light Value                     : 9.4

Exiftool suggests it has 15 additional images, using -b just prints them all to the screen. Joy -- now I have to reset my terminal.

Next, we opened it in 010 and applied the JPEG template. It looked to be 10+ JPEGs concatenated together. Let's split them on the JPEG start record bytes and write them out.

#!/usr/bin/env python

import os
import sys

contents = open("edbd4701d0b9d2a33a743e96f7bc8f3b", "rb").read()

images = contents.split("\xff\xd8\xff\xe1")
print len(images)

im = 1
for i in images:
	open(str(im) + ".jpg", "wb").write("\xff\xd8\xff\xe1" + i)
	im +=1

Key

3d_g1v35_m3_a_h3adach3