From f57654b84b4cf0ffa1287034fc9f66ba200bb259 Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 18 Sep 2018 10:52:38 +0200 Subject: First public commit --- website/css/styles.css | 63 +++++++ website/css/styles2.css | 61 +++++++ website/favicon.ico | Bin 0 -> 318 bytes website/gen_pocs.sh | 21 +++ website/index.html | 249 ++++++++++++++++++++++++++ website/robots.txt | 2 + website/samples/pdfzip/poc1/archive.zip | Bin 0 -> 75451 bytes website/samples/pdfzip/poc1/doc.pdf | Bin 0 -> 39031 bytes website/samples/pdfzip/poc1/polyglot.pdf | Bin 0 -> 114280 bytes website/samples/pdfzip/poc2/file-FILE5_32.zip | Bin 0 -> 625801 bytes website/samples/pdfzip/poc2/orwell_1984.pdf | Bin 0 -> 684772 bytes website/samples/pdfzip/poc2/polyglot.pdf | Bin 0 -> 1294892 bytes website/samples/pdfzip/poc3/fasmw17304.zip | Bin 0 -> 1071623 bytes website/samples/pdfzip/poc3/polyglot.pdf | Bin 0 -> 1878303 bytes website/samples/pdfzip/poc3/x86asm.pdf | Bin 0 -> 806073 bytes website/samples/pdfzip/poc6/eicar.zip | Bin 0 -> 229 bytes website/samples/pdfzip/poc6/hexinator.pdf | Bin 0 -> 3011364 bytes website/samples/pdfzip/poc6/polyglot.pdf | Bin 0 -> 2960704 bytes website/samples/szippdf/poc5/electronics.pdf | Bin 0 -> 796587 bytes website/samples/szippdf/poc5/hello_world.jar | Bin 0 -> 864 bytes website/samples/szippdf/poc5/polyglot.pdf | Bin 0 -> 794936 bytes website/samples/zippdf/poc4/archive.zip | Bin 0 -> 75451 bytes website/samples/zippdf/poc4/doc.pdf | Bin 0 -> 39031 bytes website/samples/zippdf/poc4/polyglot.pdf | Bin 0 -> 114187 bytes website/start_server.sh | 3 + website/update.sh | 2 + 26 files changed, 401 insertions(+) create mode 100644 website/css/styles.css create mode 100644 website/css/styles2.css create mode 100644 website/favicon.ico create mode 100755 website/gen_pocs.sh create mode 100644 website/index.html create mode 100644 website/robots.txt create mode 100644 website/samples/pdfzip/poc1/archive.zip create mode 100644 website/samples/pdfzip/poc1/doc.pdf create mode 100644 website/samples/pdfzip/poc1/polyglot.pdf create mode 100644 website/samples/pdfzip/poc2/file-FILE5_32.zip create mode 100644 website/samples/pdfzip/poc2/orwell_1984.pdf create mode 100644 website/samples/pdfzip/poc2/polyglot.pdf create mode 100644 website/samples/pdfzip/poc3/fasmw17304.zip create mode 100644 website/samples/pdfzip/poc3/polyglot.pdf create mode 100644 website/samples/pdfzip/poc3/x86asm.pdf create mode 100644 website/samples/pdfzip/poc6/eicar.zip create mode 100644 website/samples/pdfzip/poc6/hexinator.pdf create mode 100644 website/samples/pdfzip/poc6/polyglot.pdf create mode 100644 website/samples/szippdf/poc5/electronics.pdf create mode 100644 website/samples/szippdf/poc5/hello_world.jar create mode 100644 website/samples/szippdf/poc5/polyglot.pdf create mode 100644 website/samples/zippdf/poc4/archive.zip create mode 100644 website/samples/zippdf/poc4/doc.pdf create mode 100644 website/samples/zippdf/poc4/polyglot.pdf create mode 100755 website/start_server.sh create mode 100755 website/update.sh (limited to 'website') diff --git a/website/css/styles.css b/website/css/styles.css new file mode 100644 index 0000000..adc9728 --- /dev/null +++ b/website/css/styles.css @@ -0,0 +1,63 @@ +html { + background-color: black; + font-family: Consolas,monaco,monospace; + color: #92D050; +} +body { + background-color: black; + font-family: Consolas,monaco,monospace; + color: #92D050; +} +td { + background-color: black; + font-family: Consolas,monaco,monospace; + color: #92D050; +} +th { + background-color: black; + font-family: Consolas,monaco,monospace; + color: #92D050; +} +h1 { + color: white; +} +a:link { + color: #47B8C7; +} +a:visited { + color: #47B8C7; +} +a:active { + color: #47B8C7; +} +table { + border-collapse: collapse; +} +table, th, td { + border: 1px solid white; +} +th { + background-color: #92D050; + color: black; +} +th { + padding-left: 0.5em; + padding-right: 0.5em; + padding-top: 0.5em; + padding-bottom: 0.5em; +} +td { + padding-left: 0.5em; + padding-right: 0.5em; + padding-bottom: 0.5em; + padding-top: 0.5em; + text-align: left; +} + +.font_reduce { + font-size: 75%; +} + +.warning { + color: #ffb833; +} diff --git a/website/css/styles2.css b/website/css/styles2.css new file mode 100644 index 0000000..56ef7e5 --- /dev/null +++ b/website/css/styles2.css @@ -0,0 +1,61 @@ +html { + background-color: black; + font-family: Consolas,monaco,monospace; + color: #92D050; +} +body { + background-color: black; + font-family: Consolas,monaco,monospace; + color: #92D050; +} +td { + background-color: black; + font-family: Consolas,monaco,monospace; + color: #92D050; +} +th { + background-color: black; + font-family: Consolas,monaco,monospace; + color: #92D050; +} +a:link { + color: #47B8C7; +} +a:visited { + color: #47B8C7; +} +a:active { + color: #47B8C7; +} +table { + border-collapse: collapse; +} +table, th, td { + border: 1px solid white; +} +th { + background-color: #92D050; + color: black; +} +th { + padding-left: 0.5em; + padding-right: 0.5em; + padding-top: 0.5em; + padding-bottom: 0.5em; +} +td { + padding-left: 0.5em; + padding-right: 0.5em; + padding-bottom: 0.5em; + padding-top: 0.5em; + text-align: left; +} +th a:link { + color: black; +} +th a:visited { + color: black; +} +th a:active { + color: black; +} diff --git a/website/favicon.ico b/website/favicon.ico new file mode 100644 index 0000000..0ea93ea Binary files /dev/null and b/website/favicon.ico differ diff --git a/website/gen_pocs.sh b/website/gen_pocs.sh new file mode 100755 index 0000000..a62e112 --- /dev/null +++ b/website/gen_pocs.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +find -type f -name 'polyglot.pdf' -delete + +mkdir -p ./samples/pdfzip/poc1/ +../truepolyglot pdfzip --pdffile ./samples/pdfzip/poc1/doc.pdf --zipfile ./samples/pdfzip/poc1/archive.zip ./samples/pdfzip/poc1/polyglot.pdf + +mkdir -p ./samples/pdfzip/poc2/ +../truepolyglot pdfzip --pdffile ./samples/pdfzip/poc2/orwell_1984.pdf --zipfile ./samples/pdfzip/poc2/file-FILE5_32.zip ./samples/pdfzip/poc2/polyglot.pdf + +mkdir -p ./samples/pdfzip/poc3/ +../truepolyglot pdfzip --pdffile ./samples/pdfzip/poc3/x86asm.pdf --zipfile ./samples/pdfzip/poc3/fasmw17304.zip ./samples/pdfzip/poc3/polyglot.pdf + +mkdir -p ./samples/zippdf/poc4/ +../truepolyglot zippdf --pdffile ./samples/zippdf/poc4/doc.pdf --zipfile ./samples/zippdf/poc4/archive.zip ./samples/zippdf/poc4/polyglot.pdf + +mkdir -p ./samples/szippdf/poc5/ +../truepolyglot szippdf --pdffile ./samples/szippdf/poc5/electronics.pdf --zipfile ./samples/szippdf/poc5/hello_world.jar ./samples/szippdf/poc5/polyglot.pdf + +mkdir -p ./samples/pdfzip/poc6/ +../truepolyglot pdfzip --pdffile ./samples/pdfzip/poc6/hexinator.pdf --zipfile ./samples/pdfzip/poc6/eicar.zip ./samples/pdfzip/poc6/polyglot.pdf diff --git a/website/index.html b/website/index.html new file mode 100644 index 0000000..c19a2ab --- /dev/null +++ b/website/index.html @@ -0,0 +1,249 @@ + + + + + + + TruePolyglot + + + + + + + + + +

TruePolyglot

+Truepolyglot is polyglot file generator project. +This means that the generated file is composed of several file formats. The same file can be opened as a ZIP file and as a PDF file for example. +The idea of this project comes from work of Ange Albertini, International Journal of Proof-of-Concept or Get The Fuck Out and Julia Wolf that explain how we can build a polyglot file.
+Polyglot file can be fastidious to build, even more if you want to respect correctly file format. That's why I decided to build a tool to generate them.
+My main motivation was the technical challenge. +
+ +

Features and changelog

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DescriptionVersion
Build a polyglot file valid as PDF and ZIP format and that can be opened with 7Zip and Windows ExplorerPOC
Add a stream object in PDF partPOC
Polyglot file checked without warning with pdftocairo >= 1.0
Polyglot file checked without warning with caradoc >= 1.0
Rebuild PDF Xref Table>= 1.0
Stream object with correct length header value>= 1.0
Format "zippdf", file without offset after Zip data>= 1.1
Polyglot file keep original PDF version>= 1.1.1
Add "szippdf" format without offset before and after Zip data>= 1.2
Fix /Length stream object value and PDF offset for szippdf format>= 1.2.1
PDF object numbers reorder after insertion>= 1.3
+
+ +

Polyglot file compatibility

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SoftwareFormatsstatus
Acrobat Readerpdfzip, zippdfOK
Acrobat ReaderszippdfKO
Sumatra PDFpdfzip, zippdf, szippdfOK
Edgepdfzip, zippdf, szippdfOK
Firefoxpdfzip, zippdf, szippdfOK
7zippdfzip, zippdfOK with warning
7zipszippdfOK
Explorer Windowspdfzip, zippdf, szippdfOK
Info-ZIP (unzip)pdfzip, zippdf, szippdfOK
Evincepdfzip, zippdf, szippdfOK
pdftocairo -pdfpdfzip, zippdf, szippdfOK
caradoc statspdfzipOK
javaszippdfOK
+
+ + +

Examples

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PDF input fileZip input fileFormatPolyglotComment
doc.pdfarchive.zippdfzippolyglot.pdfPDF/ZIP polyglot - 122 Ko
orwell_1984.pdffile-FILE5_32.zippdfzippolyglot.pdfPDF/ZIP polyglot - 1.3 Mo
x86asm.pdffasmw17304.zippdfzippolyglot.pdfPDF/ZIP polyglot - 1.8 Mo
doc.pdfarchive.zipzippdfpolyglot.pdfPDF/ZIP polyglot - 112 Ko
electronics.pdfhello_world.jarszippdfpolyglot.pdfPDF/JAR polyglot - 778 Ko
hexinator.pdfeicar.zip (scan virustotal.com)pdfzippolyglot.pdf (scan virustotal.com)PDF/ZIP polyglot with Eicar test in Zip - 2.9 Mo
+
+ +

Manual

+
+usage: truepolyglot format [options] output-file
+
+Generate a polyglot file.
+
+Formats availables:
+* pdfzip: Generate a file valid as PDF and ZIP. The format is closest to PDF.
+* zippdf: Generate a file valid as ZIP and PDF. The format is closest to ZIP.
+* szippdf: Generate a file valid as ZIP and PDF. The format is strictly a ZIP. Archive is modified.
+
+positional arguments:
+  {pdfzip,zippdf,szippdf}
+                        Output polyglot format
+  output_file           Output polyglot file path
+
+optional arguments:
+  -h, --help            show this help message and exit
+  --pdffile PDFFILE     PDF input file
+  --zipfile ZIPFILE     ZIP input file
+  --verbose {none,error,info,debug}
+                        Verbosity level  (default: debug)
+
+TruePolyglot v1.3
+
+ +

Code

+ +Project Git repository + +

Contact

+On IRC Freenode my nickname is hackade or by mail at truepolyglot@hackade.org. + + + diff --git a/website/robots.txt b/website/robots.txt new file mode 100644 index 0000000..77470cb --- /dev/null +++ b/website/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / \ No newline at end of file diff --git a/website/samples/pdfzip/poc1/archive.zip b/website/samples/pdfzip/poc1/archive.zip new file mode 100644 index 0000000..c1eaa24 Binary files /dev/null and b/website/samples/pdfzip/poc1/archive.zip differ diff --git a/website/samples/pdfzip/poc1/doc.pdf b/website/samples/pdfzip/poc1/doc.pdf new file mode 100644 index 0000000..b31c420 Binary files /dev/null and b/website/samples/pdfzip/poc1/doc.pdf differ diff --git a/website/samples/pdfzip/poc1/polyglot.pdf b/website/samples/pdfzip/poc1/polyglot.pdf new file mode 100644 index 0000000..5943e1c Binary files /dev/null and b/website/samples/pdfzip/poc1/polyglot.pdf differ diff --git a/website/samples/pdfzip/poc2/file-FILE5_32.zip b/website/samples/pdfzip/poc2/file-FILE5_32.zip new file mode 100644 index 0000000..8a4b897 Binary files /dev/null and b/website/samples/pdfzip/poc2/file-FILE5_32.zip differ diff --git a/website/samples/pdfzip/poc2/orwell_1984.pdf b/website/samples/pdfzip/poc2/orwell_1984.pdf new file mode 100644 index 0000000..687d12a Binary files /dev/null and b/website/samples/pdfzip/poc2/orwell_1984.pdf differ diff --git a/website/samples/pdfzip/poc2/polyglot.pdf b/website/samples/pdfzip/poc2/polyglot.pdf new file mode 100644 index 0000000..497a427 Binary files /dev/null and b/website/samples/pdfzip/poc2/polyglot.pdf differ diff --git a/website/samples/pdfzip/poc3/fasmw17304.zip b/website/samples/pdfzip/poc3/fasmw17304.zip new file mode 100644 index 0000000..8e96137 Binary files /dev/null and b/website/samples/pdfzip/poc3/fasmw17304.zip differ diff --git a/website/samples/pdfzip/poc3/polyglot.pdf b/website/samples/pdfzip/poc3/polyglot.pdf new file mode 100644 index 0000000..a82491b Binary files /dev/null and b/website/samples/pdfzip/poc3/polyglot.pdf differ diff --git a/website/samples/pdfzip/poc3/x86asm.pdf b/website/samples/pdfzip/poc3/x86asm.pdf new file mode 100644 index 0000000..b7b9f4a Binary files /dev/null and b/website/samples/pdfzip/poc3/x86asm.pdf differ diff --git a/website/samples/pdfzip/poc6/eicar.zip b/website/samples/pdfzip/poc6/eicar.zip new file mode 100644 index 0000000..02850ca Binary files /dev/null and b/website/samples/pdfzip/poc6/eicar.zip differ diff --git a/website/samples/pdfzip/poc6/hexinator.pdf b/website/samples/pdfzip/poc6/hexinator.pdf new file mode 100644 index 0000000..0f87b0f Binary files /dev/null and b/website/samples/pdfzip/poc6/hexinator.pdf differ diff --git a/website/samples/pdfzip/poc6/polyglot.pdf b/website/samples/pdfzip/poc6/polyglot.pdf new file mode 100644 index 0000000..7957207 Binary files /dev/null and b/website/samples/pdfzip/poc6/polyglot.pdf differ diff --git a/website/samples/szippdf/poc5/electronics.pdf b/website/samples/szippdf/poc5/electronics.pdf new file mode 100644 index 0000000..6582363 Binary files /dev/null and b/website/samples/szippdf/poc5/electronics.pdf differ diff --git a/website/samples/szippdf/poc5/hello_world.jar b/website/samples/szippdf/poc5/hello_world.jar new file mode 100644 index 0000000..b875e1c Binary files /dev/null and b/website/samples/szippdf/poc5/hello_world.jar differ diff --git a/website/samples/szippdf/poc5/polyglot.pdf b/website/samples/szippdf/poc5/polyglot.pdf new file mode 100644 index 0000000..7733caf Binary files /dev/null and b/website/samples/szippdf/poc5/polyglot.pdf differ diff --git a/website/samples/zippdf/poc4/archive.zip b/website/samples/zippdf/poc4/archive.zip new file mode 100644 index 0000000..c1eaa24 Binary files /dev/null and b/website/samples/zippdf/poc4/archive.zip differ diff --git a/website/samples/zippdf/poc4/doc.pdf b/website/samples/zippdf/poc4/doc.pdf new file mode 100644 index 0000000..b31c420 Binary files /dev/null and b/website/samples/zippdf/poc4/doc.pdf differ diff --git a/website/samples/zippdf/poc4/polyglot.pdf b/website/samples/zippdf/poc4/polyglot.pdf new file mode 100644 index 0000000..0993dd4 Binary files /dev/null and b/website/samples/zippdf/poc4/polyglot.pdf differ diff --git a/website/start_server.sh b/website/start_server.sh new file mode 100755 index 0000000..0060e39 --- /dev/null +++ b/website/start_server.sh @@ -0,0 +1,3 @@ +#!/bin/bash +echo "http://127.0.0.1:8000" +python -m SimpleHTTPServer 8000 diff --git a/website/update.sh b/website/update.sh new file mode 100755 index 0000000..ed7f515 --- /dev/null +++ b/website/update.sh @@ -0,0 +1,2 @@ +#!/bin/bash +rsync -av --progress ./ -e ssh dragon:/var/www/html/truepolyglot/ -- cgit v1.2.3