Warning: This challenge is still active and therefore should not be resolved using this information.
Aviso: Este reto sigue en activo y por lo tanto no se debería resolver utilizando esta información.

Intro

This crackme is for the crack challenge 6 of canyouhack.it.

In this crackme the goal is to turn on all the lights. Note that a light off to the next, so if we interrupt this, we win.

Tools

Exeinfo (For crackme info)

Delphi Decompiler (For decompile)

 OllyDbg (For debug)

Decompiling

With Delphi Decompiler we can found easy the buttons and his offsets.
Go to the offset 401A64 in OllyDbg and analyze the code.
We view two jumps, one turn ON the light and the other Turn OFF the next light. Patching the call from offset 401A8B we get the serial.

Links


Computer Password Security Hacker En el primer vistazo con el editor hexadecimal ya vemos la solución al reto: Pho Al
Habitualmente suelo descargar shareware por diversión para evaluar de que manera protegen los programadores su software. Cada vez es más
File carving is the process of reassembling computer files from fragments in the absence of filesystem metadata. Wikipedia. "File carving", literalmente tallado
Alerta de Spoiler: El reto está en activo a fecha de publicación. Spoiler alert: The challenge is still alive. Este

Computer Password Security Hacker

En el primer vistazo con el editor hexadecimal ya vemos la solución al reto:

Pho

Al igual que el caso anterior con el editor hexadecimal tenemos más que suficiente para resolver el reto.

Minions

En el análisis inicial no destaca prácticamente nada excepto la palabra myadmin que podemos ver con un editor hexadecimal.

La palabra myadmin es una buena candidata a ser contraseña ante una decodificación. Probamos con lo estándar y conseguimos resultados con steghide. La decodificación nos devuelve la cadena AEMAVABGAGwAZQBhAHIAbgB7AHQAaABpAHMAXwBpAHMAXwBmAHU***** que rápidamente catalogamos como base64 para resolver el reto.

Unopenable

Se nos entrega una imagen GIF aparentemente corrupta. Estudiando un poco la cabecera de los archivos GIF llegamos rápidamente a la conclusión de que faltan los cuatro primeros bytes del archivo.

Bytes originales
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

00000000  39 61 F4 01 F4 01 F4 00 00 00 00 00 3A 00 00 00  9aô.ô.ô.....:...
00000010  00 3A 3A 00 3A 66 00 00 66 00 3A 00 00 66 90 3A  .::.:f..f.:..f.:
00000020  00 90 3A 3A B6 66 00 B6 66 3A 90 90 3A DB 90 3A  ..::¶f.¶f:..:Û.:
00000030  FF B6 66 00 3A 90 66 3A 90 00 66 90 00 66 B6 3A  ÿ¶f.:.f:..f..f¶:

Después de insertar los bytes que faltan
Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

00000000  47 49 46 38 39 61 F4 01 F4 01 F4 00 00 00 00 00  GIF89aô.ô.ô.....
00000010  3A 00 00 00 00 3A 3A 00 3A 66 00 00 66 00 3A 00  :....::.:f..f.:.
00000020  00 66 90 3A 00 90 3A 3A B6 66 00 B6 66 3A 90 90  .f.:..::¶f.¶f:..
00000030  3A DB 90 3A FF B6 66 00 3A 90 66 3A 90 00 66 90  :Û.:ÿ¶f.:.f:..f.

Una vez insertados los bytes podemos ver una animación que contiene una cadena de texto fácilmente reconocible como base64. La decodificamos y ya tenemos la solución.

Oreo

Mirando con un editor hexadecimal no encontramos nada excepto la frase This is not the flag you are looking for para intentar disuadirnos.

Cargamos la imagen en Aperi’Solve y enseguida nos llama la atención la sección Binwalk y un suculento Rar.

Descargamos el archivo Rar y al descomprimir nos encontramos con un archivo de texto con la misma frase desalentadora del inicio y una imagen JPG, esta vez con dos oreos. Inspeccionando la imagen damos con la solución.

File carving is the process of reassembling computer files from fragments in the absence of filesystem metadata. Wikipedia.

«File carving», literalmente tallado de archivos aunque lo traduciremos como extracción, es el proceso de re-ensamblado de archivos extraídos de un conjunto de mayor tamaño.

Índice

  1. Image files / Archivos de imagen
  2. Microsoft Office >2007
  3. Open Office
  4. Autocad
  5. Others / Otros
  6. Links / Enlaces

List of headers and tails / Lista de cabeceras y pies

Header = Cabecera

Footer or tail = Pie

Image files / Archivos de imagen

  • JPEG
    • Header: FFD8
    • Footer: FFD9
  • GIF87a
    • Header: 47 49 46 38 37 61
    • Footer: 00 3B
  • GIF89a
    • Header: 47 49 46 38 39 61
    • Footer: 00 3B
  • BMP
    • Header: 42 4D
    • Footer: Don’t have footer, but size is in bytes 2,3,4,5 in little-endian order (low byte first).
      • Example: 00 00 C0 38 == 49208 bytes

bmpsize

  • PNG
    • Header: 89 50 4E 47 0D 0A 1A 0A
    • Footer: 49 45 4E 44 AE 42 60 82

Microsoft Office >2007

All this documents have the same header and footer, because of this, we need search the middle bytes. This type uses a ZIP file package.

Los documentos de Microsoft Office >2007 tienen la misma cabecera y pie, por lo que necesitamos bytes intermedios para distinguirlos. Usan encapsulado ZIP.

  • DOCX
    • Header: 50 4B 03 04 14 00 06 00
      • Middle: 77 6F 72 64 (word)
    • Footer: 50 4B 05 06 (PK..) followed by 18 additional bytes at the end of the file.
  • XLSX
    • Header: 50 4B 03 04 14 00 06 00
      • Middle: 77 6F 72 6B 73 68 65 65 74 73 (worksheets)
    • Footer: 50 4B 05 06 (PK..) followed by 18 additional bytes at the end of the file.
  • PPTX
    • Header: 50 4B 03 04 14 00 06 00
      • Middle: 70 72 65 73 65 6E 74 61 74 69 6F 6E (presentation)
    • Footer: 50 4B 05 06 (PK..) followed by 18 additional bytes at the end of the file.
  • MDB / ACCDB
    • Header: 00 01 00 00 53 74 61 6E 64 61 72 64 20 4A 65 74 20 44 42 (….Standard Jet DB)
    • Footer: Don’t have footer.

Open Office

All this documents have the same header and footer, because of this, we need some bytes to differentiate them. In this case we can do this jumping 73 bytes from header. This type uses a ZIP file package.

Los documentos de OpenOffice tienen la misma cabecera y pie, por lo que necesitamos bytes intermedios para distinguirlos. Usan encapsulado ZIP.

  • ODS
    • Header: 50 4B 03 04 14 (PK..) jump +73 (0x49) bytes and 73 70 72 65 (spre)
    • Footer: 6D 61 6E 69 66 65 73 74 2E 78 6D 6C 50 4B 05 06 (manifest.xmlPK) followed by 18 additional bytes.
  • ODT
    • Header: 50 4B 03 04 14 (PK..) jump +73 (0x49) bytes and 74 65 78 64 (text)
    • Footer: 6D 61 6E 69 66 65 73 74 2E 78 6D 6C 50 4B 05 06 (manifest.xmlPK) followed by 18 additional bytes.
  • ODB
    • Header: 50 4B 03 04 14 (PK..) jump +73 (0x49) bytes and 62 61 73 65 (base)
    • Footer: 6D 61 6E 69 66 65 73 74 2E 78 6D 6C 50 4B 05 06 (manifest.xmlPK) followed by 18 additional bytes.
  • ODG
    • Header: 50 4B 03 04 14 (PK..) jump +73 (0x49) bytes and 67 72 61 70 (grap)
    • Footer: 6D 61 6E 69 66 65 73 74 2E 78 6D 6C 50 4B 05 06 (manifest.xmlPK) followed by 18 additional bytes.
  • ODF
    • Header: 50 4B 03 04 14 (PK..) jump +73 (0x49) bytes and 66 6F 72 6D (form)
    • Tail: 6D 61 6E 69 66 65 73 74 2E 78 6D 6C 50 4B 05 06 (manifest.xmlPK) followed by 18 additional bytes.
  • ODP
    • Header: 50 4B 03 04 14 (PK..) jump +73 (0x49) bytes and 70 72 65 73 (pres)
    • Footer: 6D 61 6E 69 66 65 73 74 2E 78 6D 6C 50 4B 05 06 (manifest.xmlPK) followed by 18 additional bytes.

Autocad

  • DWG (R11/R12 versions)
    • Header: 41 43 31 30 30 39
    • Footer: CD 06 B2 F5 1F E6
  • DWG (R14 version)
    • Header: 41 43 31 30 31 34
    • Footer: 62 A8 35 C0 62 BB EF D4
  • DWG (2000 version)
    • Header: 41 43 31 30 31 34
    • Footer: DB BF F6 ED C3 55 FE
  • DWG (>2007 versions)
    • Header: 41 43 31 30 XX XX
    • Footer: Don’t have

Note: >2007 versions have two patterns and the key is the position 0x80. If in this position we get the bytes «68 40 F8 F7 92», we need to search again for this bytes and displace 107 bytes to find the end of the file. If in the position 0x80 we get another different bytes, we need to search again this bytes and displace 1024 bytes to find the end of the file.

Nota: Las versiones >2007 siguen dos patrones y la clave está en la posición 0x80. Si en la posicion 0x80 obtenemos los bytes «68 40 F8 F7 92», los buscamos una segunda vez y ha 107 bytes encontramos el final del archivo. Si en la posición 0x80 obtenemos otros bytes diferentes a los del primer caso, los volvemos a buscar y a 1024 bytes hallaremos el final del archivo.

Others / Otros

  • PDF
    • Header: 25 50 44 46 (%PDF)
    • Footers:
      • 0A 25 25 45 4F 46 (.%%EOF) or
      • 0A 25 25 45 4F 46 0A (.%%EOF.) or
      • 0D 0A 25 25 45 4F 46 0D 0A (..%%EOF..) or
      • 0D 25 25 45 4F 46 0D (.%%EOF.)
  • ZIP
    • Header: 50 4B 03 04
    • Footer: 50 4B 05 06 (PK..) followed by 18 additional bytes at the end of the file.
  • RAR (< 4.x version)
    • Header: 52 61 72 21 1A 07 00
    • Tail: C4 3D 7B 00 40 07 00
  • 7ZIP
    • Header: 37 7A BC AF 27 1C 00 03  (7z¼¯’…)
    • Footer: 01 15 06 01 00 20 followed by 5 additional bytes at the end of the file.
  • RTF
    • Header: 7B 5C 72 74 66 31
    • Footer: 5C 70 61 72 20 7D

Links / Enlaces

Alerta de Spoiler: El reto está en activo a fecha de publicación.

Spoiler alert: The challenge is still alive.

Este tipo de retos son de lo más variopinto pero una de las primeras cosas que se suele hacer es ver el código fuente y fijarse en los enlaces para hacernos una idea del tipo de vulnerabilidades a explotar. Empezamos por explorar el código fuente.

<html>
<head>
    <link href="../../assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">
    <script src="../../assets/js/jquery.min.js" type="text/javascript"></script>
    <meta charset="UTF-8">
    <style>
        body{
            background-color: #111;
        }
        .main{
            background-color: #fff;
        }
    </style>
</head>
<body>
<div class="container main">
    <div class="jumbotron">
        <div class="container">
            <h1>ジェフのショップ</h1>
            <p>ジェフのショップへようこそ、私たちは...私たちは、新しいセキュリティシステムを幸せ持っています <img height="100" width="100" src="source/cat.gif"></p>
            <p><a class="btn btn-primary btn-lg" href="#" role="button">もっと詳しく知る »</a></p>
        </div>
    </div>
    <div class="row">
        <!-- Example row of columns -->
        <div class="row text-center">
            <div class="col-md-4">
                <h2>車</h2>
                <p class="text-center" style="margin: 20px;">我々 50,000円の価格で車を販売しています. </p>
                <p><a class="btn btn-danger " href="#" role="button">今すぐ購入<span class="glyphicon glyphicon-shopping-cart"></span></a></p>
            </div>
            <div class="col-md-4">
                <h2>剣</h2>
                <p class="text-justify" style="margin: 20px;">我々は、 25円の価格のために地球全体の最も鋭い剣を販売しています </p>
                <p><a class="btn btn-danger " href="#" role="button">今すぐ購入<span class="glyphicon glyphicon-shopping-cart"></span></a></p>
            </div>
            <div class="col-md-4">
                <h2>赤ジェフの毒</h2>
                <p class="text-justify" style="margin: 20px;">我々は毒、世界に存在するほとんどの不治の毒を販売しています。プライスレス90000.</p>
                <p><a class="btn btn-danger " href="#" role="button">今すぐ購入<span class="glyphicon glyphicon-shopping-cart"></span></a></p>
            </div>
        </div>
        <hr>
    </div>
    <div class="row">
        <!-- Example row of columns -->
        <div class="row text-center">
            <div class="col-md-4">
                <h2>魔法の脳</h2>
                <p class="text-justify" style="margin: 20px;">彼らは私たちの脳販売しているいくつかの場面で非常に便利です。その価格は約10円です.</p>
                <p><a class="btn btn-danger " href="#" role="button">今すぐ購入<span class="glyphicon glyphicon-shopping-cart"></span></a></p>
            </div>
            <div class="col-md-4">
                <h2>侵入テスト</h2>
                <p class="text-justify" style="margin: 20px;">私たちはあなたのウェブページやサーバーで完全なセキュリティを提供します。これはジェフの店の最高の製品です。</p>
                <p><a class="btn btn-danger " href="#" role="button">今すぐ購入<span class="glyphicon glyphicon-shopping-cart"></span></a></p>
            </div>
        </div>
        <hr>
    </div>
    <footer>
        <p>© ジェフは2015フンメルス</p>
    </footer>
</div>
</body>
</html>

A simple vista no hay nada sospechoso pero me llama la atención el enlace de la imagen del gatito «source/cat.gif«. Si fisgamos dentro de la carpeta «source» podemos ver que nos muestra el contenido de la carpeta como se puede apreciar en la imagen a continuación.

Contenido de la carpeta source

Contenido de la carpeta source

La carpeta «app» suena interesante. Hacemos clic y vemos lo siguiente.

Notice: Undefined index: commit in C:/xampp/htdocs/challenge-land/Realistic/shop/source/app/index.php on line 2

Vemos que el error mostrado muestra más información de la debida y la aprovecharemos en beneficio propio. Aquí la clave está en el fichero index.php y en el parámetro commit. Haremos una prueba para ver que vamos por el buen camino.

http://challengeland.co/Realistic/e4633b53f9/source/app/index.php?commit

y recibimos el error «The commit number not found.»

Probamos entonces añadiendo números al parámetro commit y nos fijamos en las respuestas.

http://challengeland.co/Realistic/e4633b53f9/source/app/index.php?commit=1
すべて更新
http://challengeland.co/Realistic/e4633b53f9/source/app/index.php?commit=2
Jeff@shop.com 2013年5月5日 - >ちょっと私たちは.htpasswdの使用する必要がジェームズと.htaccess保護...本当に安全です。すべてのファイルを更新します
http://challengeland.co/Realistic/e4633b53f9/source/app/index.php?commit=3
すべて更新
http://challengeland.co/Realistic/e4633b53f9/source/app/index.php?commit=4
すべて更新
http://challengeland.co/Realistic/e4633b53f9/source/app/index.php?commit=5
すべて更新
http://challengeland.co/Realistic/e4633b53f9/source/app/index.php?commit=6
James@shop.com 2013年5月7日に - >ジェフ、大丈夫、私はそれに仕事に行きます。すべてのファイルを更新し、覚えています - jeffshop:adm1n$2015*+
http://challengeland.co/Realistic/e4633b53f9/source/app/index.php?commit=7
すべて更新
http://challengeland.co/Realistic/e4633b53f9/source/app/index.php?commit=8
jeff@shop.com 2013年5月9日 - >ジェームズ、良い仕事...新しいユーザーとパスがあります jeffcrazyshop:h4rDtoF1nD

Hay varias respuestas sugerentes pero quizá la más relevante es la 8. Ahora bien, solo falta encontrar donde introducir el usuario y la clave.

Si volvemos a la página principal vemos en el enlace algo interesante, me refiero a index.php?page=index. Tras probar varias cosas la que funciona es la típica, admin.

http://challengeland.co/Realistic/e4633b53f9/index.php?page=admin

Al entrar vemos que nos redirige al index de nuevo tras pocos segundos. Aquí hay dos opciones, desactivar javascript para evitar la redirección o entrar directamente a la página admin.php. Optamos por el camino fácil entrando directamente en admin.php:

http://challengeland.co/Realistic/e4633b53f9/admin.php

Login

Login

Introduciendo los datos obtenidos anteriormente nos muestra la querida flag.

Enlaces