Rating: 4.5
<span>The website at https://cthulhu.fluxfingers.net/challenges/4
allows you to download a pdf file. It contains an attachment named pdf10000.pdf.
</span>
Attachment pdf10000.pdf contains another attachment named
pdf9999.pdf; pdf9999.pdf contains pdf9998.pdf and so on...
<span>
With this behavior in mind, we can write a script to
automate the extraction process. The assumption is that pdf0.pdf might contain the flag.</span>
----------------------------------------------------------------------------------------------------
<span>#Environment: Linux
#https://cthulhu.fluxfingers.net/static/chals/simplepdf_f8004a3ad0acde31c40267b9856e63fc.pdf
#Extract pdf10000.pdf and use the script
from subprocess import call
ctr = 10000
pdfname = "pdf10000.pdf"
while ctr > 0:
call(["pdfdetach", "-saveall", pdfname]) #for more info http://www.dsm.fordham.edu/cgi-bin/man-cgi.pl?topic=pdfdetach§=1
ctr -= 1
pdfname = "pdf" + str(ctr) + ".pdf"</span>
----------------------------------------------------------------------------------------------------
From the script above, pdf0.pdf was extracted. It contains
start.pdf which contains the flag.
<span>The flag is flag{pdf_packing_is_fun}</span>