Skip to content

Instantly share code, notes, and snippets.

@shinh
Created May 14, 2018 13:56
Show Gist options
  • Save shinh/c7e4aada27941a1dff839557286534ec to your computer and use it in GitHub Desktop.
Save shinh/c7e4aada27941a1dff839557286534ec to your computer and use it in GitHub Desktop.
DEFCON 2018 Qual ELF Crumble
Encoding.default_external = 'binary'
Encoding.default_internal = 'binary'
c = File.open('pieces/broken', 'r:binary').read
p c[0x5b0-3...0x8d4].size
frags = (1..8).map{|i|File.read("pieces/fragment_#{i}.dat")}
p frags.map{|f|f.size}.inject(:+)
[*0..7].permutation.each do |a|
ff = ''
a.each do |i|
ff += frags[i]
end
cc = c * 1
cc[0x5b0-3...0x8d4] = ff
File.write('try', cc)
File.chmod(0755, 'try')
system('./try')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment