-
Notifications
You must be signed in to change notification settings - Fork 1
/
index2.html
185 lines (175 loc) · 15.8 KB
/
index2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<!DOCTYPE html>
<html lang="en">
<head>
<title>aufarg:/var/log $ _</title>
<link href='https://fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet' type='text/css'>
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300" rel="stylesheet">
<link rel="stylesheet" href="https://aufarg.github.io/theme/css/main.css" type="text/css" />
<link rel="stylesheet" href="https://aufarg.github.io/theme/css/pygments.css" type="text/css" />
<link rel="stylesheet" href="https://aufarg.github.io/theme/css/font-awesome.min.css" type="text/css" />
<meta charset="utf-8" />
</head>
<body id="index" class="home">
<header id="banner" class="body">
<div class="banner"><a href="https://aufarg.github.io">aufarg:/var/log $ _ <strong></strong></a></div>
<nav>
<ol class="nav">
<li><a href="https://aufarg.github.io/categories.html">categories</a> </li>
<li><a href="https://aufarg.github.io/tags.html">tags</a> </li>
<li><a href="https://aufarg.github.io/archives.html">archive</a></li>
</ol>
<ul>
</ul>
</nav>
</header>
<div class="box">
<section id="content">
<div class="posts">
<ol id="post-list">
<li>
<article class="archive">
<header class="post">
<h1 class="archive-post-title">
<a href="https://aufarg.github.io/cyber-sea-game-2017-addcrypto-50.html" rel="bookmark" title="permalink to Cyber Sea Game 2017: addcrypto (50)">Cyber Sea Game 2017: addcrypto (50)</a>
</h1>
</header>
<div class="post-info">
<div class="post-date">
<abbr>Wed 29 November 2017</abbr> ·
< 1 min read </div>
</div> <div class="post-summary"> <p>We are given a file, <code>encrypt.py</code>, which looks as follows.</p>
<div class="highlight"><pre><span class="code-line"><span></span><span class="kn">import</span> <span class="nn">os</span></span>
<span class="code-line"><span class="kn">from</span> <span class="nn">flag</span> <span class="kn">import</span> <span class="n">flag</span></span>
<span class="code-line"></span>
<span class="code-line"><span class="n">message</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">urandom</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span> <span class="o">+</span> <span class="n">flag</span></span>
<span class="code-line"></span>
<span class="code-line"><span class="n">cipher</span> <span class="o">=</span> <span class="s1">''</span></span>
<span class="code-line"><span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">):</span></span>
<span class="code-line"> <span class="n">cipher</span> <span class="o">+=</span> <span class="nb">chr</span><span class="p">((</span><span class="nb">ord</span><span class="p">(</span><span class="n">message</span><span class="p">[</span><span class="n">i</span><span class="p">])</span> <span class="o">+</span> <span class="nb">ord</span><span class="p">(</span><span class="n">message</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">])</span> <span class="o">+</span> <span class="nb">ord</span><span class="p">(</span><span class="n">message</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">]))</span> <span class="o">&</span> <span class="mh">0xff</span><span class="p">)</span></span>
<span class="code-line"></span>
<span class="code-line"><span class="k">print</span> <span class="n">cipher</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="s1">'hex'</span><span class="p">)</span></span>
<span class="code-line"><span class="c1"># 4c8f7236c7b259b4e9b792929f2d59534437394530392a2547645958522d3d3b4e3e412c2f2a47314b604d483849342534413e516673 …</span></span></pre></div>
<a href="https://aufarg.github.io/cyber-sea-game-2017-addcrypto-50.html">read more</a></div>
</article>
</li>
<li>
<article class="archive">
<header class="post">
<h1 class="archive-post-title">
<a href="https://aufarg.github.io/cyber-sea-game-2017-rsa-8192-200.html" rel="bookmark" title="permalink to Cyber Sea Game 2017: rsa-8192 (200)">Cyber Sea Game 2017: rsa-8192 (200)</a>
</h1>
</header>
<div class="post-info">
<div class="post-date">
<abbr>Wed 29 November 2017</abbr> ·
< 1 min read </div>
</div> <div class="post-summary"> <p>We are given a file, <code>encrypted.txt</code>, which looks as follows.</p>
<div class="highlight"><pre><span class="code-line"><span></span>encrypted = flag^e mod N</span>
<span class="code-line"></span>
<span class="code-line">N=929412161736416785602626791790087761924898902195151595398647919800777946023488971853180598176692598583294061182260536041579346366926172653588840221567273437362595402878942949261351013183228816076787208298761416393920642857987212821185440640229264390419503134199675174977584782229111062529809687171117150001744486594819183472678424697917104835410391461624730889726473874533632011783818612095039231758588125644714046393001791112810853913402405581873909038522129835207451007166051445611924869493431837474285007276641743601868212445343248507996492168302629410158793171095836266438216336450410161777445930018295413880788397817212920901086111768107584700273194248624078825784962833148389339669672770486880797307481695588172832838731072379885756990402094668632885608688308703281839275920814948615941253077843879626529478150269189961487485485588639730236538541375331823636862137530268960752698621771461443704327244021041422495986281380147586211470392418121029373841474934960486004859939618776068437679091746000882065500417603392927878932556252121339876316869065207294672799230304843433288112308586240048684735313520164083326788976779830776801482533953926103609143333554819874985879730182046630820535196380040115825136940584589556785820159343472924511678054586101279599213597041601780382296431834866858061507446104315668473990065085836000677940559666983863740858655209448321924892616633958276590031999377342119486934203280802950550853609192641981061152748812514091191340011124311081998324364749868579702401217654561296975509502208974088057282185982036347055436781944503659441121489871215835821003778237875885585700465817962525400543288824177317817062453958271388228532199292458847881512536878190894921450789438099744648090308652667907702590059579778875658483803814963849425246348271265297992326326941649385344794434378497144236903691683724320406798550633839076630007346411875416248546336032185298058900521975982336237334536607755792300625619630545602773119916582573302060747209289533363253570250473519076096695447047922887567718357635771477087257951066557774977631702031440524698209045937363875790679216746249380353174688379191327766840638039388162445662493445777856792810700198251083685207125399710828301628160312264601730356710220261724123846339093165967118971272821247106002282782902865842552867964918068336459439425481643750939492002728297110520672697512136349144736715821664013325546531282992945883469394942896186838909299361507395054625609900948608639067118377943217351</span>
<span class="code-line">e=65537</span>
<span class="code-line">encrypted=920588809098419925304898815996779959024923992725236480766957762101020068092418642972569896909288446822625160018245995852395637010359546968987469161375560974732331888587499575726726591661288086170102991231536351472553667136912003817645761994113867006023358064959804334508836786614546373318854185561928539181380849135202589436399469446278977853873976388512625983066695071220448389094452382204859072246204132607199499483725325567718766144169704838594296010882715656390868083309425868664311629487870655537301587586264593373623106904074718645449224372238734853263892364592224060906009118410260996474851170094609808378917112241913945371712277407646776651895736210620267993703347840913541477388590431559378925211730392071715903857032396752409447351784452479847357247902830713107054131920974381233928620873147787352397722780557371121588138822734422526916591197108637109219278170352817301806094020568558870258047526598307845757398567950006581582539714075107753798978096510308355532420719999999220855138247162168113460577910905929588333387729891130789423649360964154825883032891254447994769161274294764104742371937868945566163338795266034258979330588673875819190729858101607459440752551327488554472157318363257082223209451608433992248074386159317605908434880514654833712622074369971266584704933749205856068601008066620986626613108276972360189307015131946572931252688986331609366041663453234811061216223134001974803179901785278084643248758399580372104073097458529704426905971473072151381373448553361414418342456280135383419519503028786544292302907897461141075166092520323444990854104372309393440260002551733596011221728567186544196673107818614484776574487330137101004134890658956591489639306529923386792687879390716232617992555567785121188340568023697639047632424964759610425447619800320974777755083401005364154241941027256239760103909197224362499684459388821532418774937557650857921765385859799914470867641296667037230734819015690775890840326939101061216700887599083952915657512483532308094437422732323767769158944259841802993244806549824743056280460644331001819024060314281381987785996895717885719094296415336981352928519848848055894963780262847910621421107636554884980968204334872719316159028387134320156378724268116858255133532724522370999208549105477046537264757515852756867521989580046767357180880003025052171778061564683996167899012373574038101166777008676727628024284803295629377550189159115681868387149280045459828574367106610925183390170585407262031209717446921115630</span>
</pre></div>
<p>Since there's no gimmick in the encryption process, let's try factorize <code>N</code>. Factoring <code>N</code> with
<a href="https://en.wikipedia.org/wiki/Fermat's_factorization_method">Fermat's factorization</a> included
in <a href="https://sourceforge.net/projects/yafu/">Yafu</a> yield <code>p</code> and <code>q</code> used to create <code>N …</code></p>
<a href="https://aufarg.github.io/cyber-sea-game-2017-rsa-8192-200.html">read more</a></div>
</article>
</li>
<li>
<article class="archive">
<header class="post">
<h1 class="archive-post-title">
<a href="https://aufarg.github.io/tuctf-2017-crypto-clock-300.html" rel="bookmark" title="permalink to TUCTF 2017: Crypto Clock (300)">TUCTF 2017: Crypto Clock (300)</a>
</h1>
</header>
<div class="post-info">
<div class="post-date">
<abbr>Mon 27 November 2017</abbr> ·
4 min read </div>
</div> <div class="post-summary"> <p>We are given a network dump file, <code>network_dump</code> and a service that we can connect to. After we
open the file, we find two file was transmitted. The first one is the <code>keys</code> file which contains
the following:</p>
<div class="highlight"><pre><span class="code-line"><span></span>{</span>
<span class="code-line">"n":142592923782837889588057810280074407737423643916040668869726059762141765501708356840348112967723017380491537652089235085114921790608646587431612689308433796755742900776477504777927984318043841155548537514797656674327871309567995961808817111092091178333559727506289043092271411929507972666960139142195351097141,</span>
<span class="code-line">"e": 3</span>
<span class="code-line">}</span>
</pre></div>
<p>The second one is a python script file …</p>
<a href="https://aufarg.github.io/tuctf-2017-crypto-clock-300.html">read more</a></div>
</article>
</li>
<li>
<article class="archive">
<header class="post">
<h1 class="archive-post-title">
<a href="https://aufarg.github.io/tuctf-2017-guestbook-250.html" rel="bookmark" title="permalink to TUCTF 2017: Guestbook (250)">TUCTF 2017: Guestbook (250)</a>
</h1>
</header>
<div class="post-info">
<div class="post-date">
<abbr>Mon 27 November 2017</abbr> ·
2 min read </div>
</div> <div class="post-summary"> <p>We are given an ELF executable file, <code>guestbook</code> and a service for the executable. Our goal is
to spawn a shell from the service. Decompiling <code>guestbook</code> with IDA will yield this C pseudo-code:</p>
<div class="highlight"><pre><span class="code-line"><span></span><span class="kt">int</span> <span class="kr">__cdecl</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">**</span><span class="n">argv</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">**</span><span class="n">envp</span><span class="p">)</span></span>
<span class="code-line"><span class="p">{</span></span>
<span class="code-line"> <span class="kt">char</span> <span class="n">s</span><span class="p">;</span> <span class="c1">// [sp+0h] [bp-98h]@16 …</span></span></pre></div>
<a href="https://aufarg.github.io/tuctf-2017-guestbook-250.html">read more</a></div>
</article>
</li>
<li>
<article class="archive">
<header class="post">
<h1 class="archive-post-title">
<a href="https://aufarg.github.io/meepwn-ctf-2017-simpler-rsa-100.html" rel="bookmark" title="permalink to MeePwn CTF 2017: Simpler RSA (100)">MeePwn CTF 2017: Simpler RSA (100)</a>
</h1>
</header>
<div class="post-info">
<div class="post-date">
<abbr>Tue 18 July 2017</abbr> ·
2 min read </div>
</div> <div class="post-summary"> <p>We are given two files: one is <code>simple.py</code>, which used to do an encryption, and <code>pubkey.txt</code>,
which is the generated public key when encrypting with <code>simple.py</code>. Here's the content of
<code>simpe.py</code>.</p>
<div class="highlight"><pre><span class="code-line"><span></span><span class="kn">from</span> <span class="nn">Crypto.Util.number</span> <span class="kn">import</span> <span class="o">*</span></span>
<span class="code-line"><span class="kn">import</span> <span class="nn">random</span></span>
<span class="code-line"><span class="c1"># from flag import FLAG</span></span>
<span class="code-line"></span>
<span class="code-line"><span class="k">def</span> <span class="nf">generate</span><span class="p">(</span><span class="n">nbits</span><span class="p">):</span></span>
<span class="code-line"> <span class="n">p …</span></span></pre></div>
<a href="https://aufarg.github.io/meepwn-ctf-2017-simpler-rsa-100.html">read more</a></div>
</article>
</li>
</ol>
</div>
<p class="pagination">
<a href="https://aufarg.github.io/index.html"><i class="fa fa-angle-left direction" aria-hidden="true"></i></a>
page 2 / 3
<a href="https://aufarg.github.io/index3.html"><i class="fa fa-angle-right direction" aria-hidden="true"></i></a>
</p>
</section>
<hr/>
</div>
<footer id="siteinfo" class="footer">
<div>
<a href="https://aufarg.github.io">Aufar Gilbran</a> (2012)
</div>
<div>
powered by <a href="http://getpelican.com/">Pelican</a>
and <a href="http://python.org">Python</a>.
Theme based on <a href="http://github.com/slok/iris">iris</a>
</div>
<div>
Icons from Font Awesome by <a href="http://fontawesome.io/"> font awesome</a>.
<a href="https://fonts.google.com/specimen/Open+Sans+Condensed">Title & headers</a>, <a href="https://fonts.google.com/specimen/Lato">body</a> and <a href="https://fonts.google.com/specimen/Inconsolata">source code</a> fonts by google fonts
</div>
<div class="social">
<a href="https://github.com/aufarg"><i class="fa fa-github-square"></i></a>
<a href="#"><i class="fa fa-Another social link-square"></i></a>
<a href="mailto:aufargilbran@gmail.com"><i class="fa fa-envelope-square"></i></a>
</div>
</footer>
</body>
</html>