Created
May 14, 2018 13:56
-
-
Save shinh/c7e4aada27941a1dff839557286534ec to your computer and use it in GitHub Desktop.
DEFCON 2018 Qual ELF Crumble
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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