TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Pulling JPEGs out of thin air

444 pointsby atulagarwalover 10 years ago

20 comments

tux3over 10 years ago
This is INSANELY COOL.<p>If it&#x27;s smart enough to learn how to build a JPEG in a day, use it with netcat and it could probably send quite a lot of things down in flames.<p>Who needs static analysis :) ?
评论 #8573758 未加载
评论 #8573937 未加载
评论 #8574856 未加载
vinhboyover 10 years ago
At the risk of sounding really stupid. Can someone ELI5 what&#x27;s going on here and why everyone thinks its so amazing?
评论 #8573950 未加载
评论 #8573970 未加载
评论 #8573972 未加载
评论 #8574053 未加载
评论 #8574074 未加载
userbinatorover 10 years ago
I remember a very similar technique being used successfully for automatically cracking software (registration keys&#x2F;keyfiles, serial numbers) before Internet-based validation and stronger crypto became common; the difference is that method didn&#x27;t require having access to any source code or recompiling the target, as it just traced execution and &quot;evolved&quot; itself toward inputs producing longer and wider (i.e. more locations in the binary) traces.
评论 #8574942 未加载
bonzoqover 10 years ago
The author of this article is a hacker from the time, when the word hacker meant something different than it does today. I remember his website from my early teens when I started using the internet via a dial-up connection back in 1998. Lcamtuf, glad to see you&#x27;re still around. Your fellow countryman.
zackmorrisover 10 years ago
Potential instructions for trying this on Mac (I was unable to make it work, perhaps we can build upon this):<p>curl -LO <a href="http://lcamtuf.coredump.cx/afl.tgz" rel="nofollow">http:&#x2F;&#x2F;lcamtuf.coredump.cx&#x2F;afl.tgz</a><p>tar zxvf afl.tgz<p>rm afl.tgz<p>cd afl*<p>make afl-gcc<p>make afl-fuzz<p>mkdir in_dir<p>echo &#x27;hello&#x27; &gt;in_dir&#x2F;hello<p># there is a glitch with the libjpeg-turbo-1.3.1 configure file that makes it difficult to compile on Mac, so I tried regular libjpeg:<p>curl -LO <a href="http://www.ijg.org/files/jpegsrc.v8c.tar.gz" rel="nofollow">http:&#x2F;&#x2F;www.ijg.org&#x2F;files&#x2F;jpegsrc.v8c.tar.gz</a><p>tar zxvf jpegsrc.v8c.tar.gz<p>cd jpeg-8c&#x2F;<p>CC=..&#x2F;afl-gcc .&#x2F;configure<p>make<p># error: C compiler cannot create executables<p># if the above command worked to build an instrumented djpeg, then this should work<p>cd ..<p>.&#x2F;afl-fuzz -i in_dir -o out_dir .&#x2F;jpeg-8c&#x2F;djpeg
评论 #8577471 未加载
im2w1lover 10 years ago
Regarding<p>&gt;if (strcmp(header.magic_password, &quot;h4ck3d by p1gZ&quot;)) goto terminate_now;<p>How impossible would it be to look at the branching instruction, perform a taint analysis on its input and see if there is any part of the input we can tweak to make it branch&#x2F;not branch. Like, we jumped because the zero flag was set. And the zero flags was set because these two bytes were equal. Hmm that byte is hardcoded. This other byte was mov&#x27;d here from that memory address. That memory address was set by this call to fread... hey, it come from this byte in the input file.
评论 #8573928 未加载
评论 #8574022 未加载
rainforestover 10 years ago
See also: Microsoft Code Digger [1], which generates inputs using symbolic execution for .net code, and EvoSuite, which uses a genetic algorithm to do the same for Java [2].<p>[1] : <a href="http://blogs.msdn.com/b/nikolait/archive/2013/04/23/introducing-code-digger-an-extension-for-vs2012.aspx" rel="nofollow">http:&#x2F;&#x2F;blogs.msdn.com&#x2F;b&#x2F;nikolait&#x2F;archive&#x2F;2013&#x2F;04&#x2F;23&#x2F;introduc...</a><p>[2] : <a href="http://www.evosuite.org" rel="nofollow">http:&#x2F;&#x2F;www.evosuite.org</a>
Mchlover 10 years ago
I like to imagine that given enough time it eventually generates the Lenna [1] jpeg and exits<p>[1] : <a href="https://en.wikipedia.org/wiki/Lenna" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Lenna</a>
gear54rusover 10 years ago
I had a brief &#x27;It&#x27;s alive :O&#x27; moment when reading this, imagine seeing face looking at you in one of those pics :)<p>Nice article, concept of fuzzers was new to me.
raisedbyninjasover 10 years ago
I&#x27;m not familiar with how the fuzzer was monitoring the executed code path. Would this be thwarted by address space layout randomization?
评论 #8574379 未加载
评论 #8575298 未加载
评论 #8574163 未加载
ionforceover 10 years ago
Sounds very much like a genetic algorithm&#x2F;evolutionary computation.
评论 #8575373 未加载
baneover 10 years ago
Wow, two awesome ideas in a week. Reminds me of this posted just a couple days ago <a href="http://reverseocr.tumblr.com/" rel="nofollow">http:&#x2F;&#x2F;reverseocr.tumblr.com&#x2F;</a>
JonnieCacheover 10 years ago
Now to try this with midi...<p>But what to feed it into? I could make some musical analysis stuff, but do I need to write it in C to avoid accidentally fuzzing my interpreter?
评论 #8575705 未加载
评论 #8574652 未加载
1risover 10 years ago
OT: Is there a simple, little fuzzer that just uses grammars as templates for their outputs?
评论 #8573980 未加载
stevebotover 10 years ago
You can throw afl-fuzz at many other types of parsers with similar results: with bash, it will write valid scripts;<p>^ that seems fun, I just don&#x27;t think I would run it on my machine for fear of what it might create (oh.. rm -rf * ok!)
vitamenover 10 years ago
The beginning of this article reads eerily similar to the beginning of Greg Egan&#x27;s Diaspora, though in a much more limited context.
fenollpover 10 years ago
What if we feed afl a program that checks whether a number is prime? Will it slowly discover a way to make primes?
fit2ruleover 10 years ago
This is awesome .. &quot;Go Away or I will Replace You With a Fuzz&quot; seems like my next t-shirt order ..
slvnover 10 years ago
This what a hacker be.
byEngineerover 10 years ago
This is totally amazing! Wondering if it would be possible to go the other way around: from generated JPG to a string. If yes, what a cool way to send your password as a... JPG over email.
评论 #8573817 未加载
评论 #8573873 未加载