Security Bugs in Embedded Interpreters
Haogang Chen, Cody Cutler, Taesoo Kim, Yandong Mao, Xi Wang, Nickolai Zeldovich and M. Frans Kaashoek MIT CSAIL
Security Bugs in Embedded Interpreters Haogang Chen, Cody Cutler, - - PowerPoint PPT Presentation
Security Bugs in Embedded Interpreters Haogang Chen, Cody Cutler, Taesoo Kim, Yandong Mao, Xi Wang, Nickolai Zeldovich and M. Frans Kaashoek MIT CSAIL Embedded interpreters Host system Bytecode Embedded Output interpreter Input
Haogang Chen, Cody Cutler, Taesoo Kim, Yandong Mao, Xi Wang, Nickolai Zeldovich and M. Frans Kaashoek MIT CSAIL
Host system Embedded interpreter Bytecode Input Output
Host system Embedded interpreter Bytecode Input Output
Host system Embedded interpreter Bytecode Input Output
Host system Embedded interpreter Bytecode Input Output
Software Interpreter Known vulnerabilities
Software Interpreter Known vulnerabilities
BPF CVE-2010-4158 CVE-2012-3729 INET_DIAG CVE-2010-3880 CVE-2011-2213 AML CVE-2010-4347 CVE-2011-1021
Software Interpreter Known vulnerabilities
BPF CVE-2010-4158 CVE-2012-3729 INET_DIAG CVE-2010-3880 CVE-2011-2213 AML CVE-2010-4347 CVE-2011-1021 RarVM CVE-2007-3725 LLVM CVE-2011-3627
Software Interpreter Known vulnerabilities
BPF CVE-2010-4158 CVE-2012-3729 INET_DIAG CVE-2010-3880 CVE-2011-2213 AML CVE-2010-4347 CVE-2011-1021 RarVM CVE-2007-3725 LLVM CVE-2011-3627 Bitcoin bitcoin CVE-2010-5137
Software Interpreter Known vulnerabilities
BPF CVE-2010-4158 CVE-2012-3729 INET_DIAG CVE-2010-3880 CVE-2011-2213 AML CVE-2010-4347 CVE-2011-1021 RarVM CVE-2007-3725 LLVM CVE-2011-3627 Bitcoin bitcoin CVE-2010-5137 Python Pickle CVE-2011-2520 CVE-2012-4406
Software Interpreter Known vulnerabilities
BPF CVE-2010-4158 CVE-2012-3729 INET_DIAG CVE-2010-3880 CVE-2011-2213 AML CVE-2010-4347 CVE-2011-1021 RarVM CVE-2007-3725 LLVM CVE-2011-3627 Bitcoin bitcoin CVE-2010-5137 Python Pickle CVE-2011-2520 CVE-2012-4406 FreeType TrueType / Type 1 Charstring CVE-2010-2520 CVE-2011-0226
Software Interpreter Known vulnerabilities
BPF CVE-2010-4158 CVE-2012-3729 INET_DIAG CVE-2010-3880 CVE-2011-2213 AML CVE-2010-4347 CVE-2011-1021 RarVM CVE-2007-3725 LLVM CVE-2011-3627 Bitcoin bitcoin CVE-2010-5137 Python Pickle CVE-2011-2520 CVE-2012-4406 FreeType TrueType / Type 1 Charstring CVE-2010-2520 CVE-2011-0226
Software Interpreter Known vulnerabilities
BPF CVE-2010-4158 CVE-2012-3729 INET_DIAG CVE-2010-3880 CVE-2011-2213 AML CVE-2010-4347 CVE-2011-1021 RarVM CVE-2007-3725 LLVM CVE-2011-3627 Bitcoin bitcoin CVE-2010-5137 Python Pickle CVE-2011-2520 CVE-2012-4406 FreeType TrueType / Type 1 Charstring CVE-2010-2520 CVE-2011-0226
$"tcpdump"‘ip"src"net"not"(18.26.5.0/24"or"18.1.2.0/24)’
$"tcpdump"‘ip"src"net"not"(18.26.5.0/24"or"18.1.2.0/24)’
ip*src*net*not* (18.26.5.0/24*or*18.0.0.0/24)
tcpdump
kernel
**** * * * **** * * * packets filtered packets
$"tcpdump"‘ip"src"net"not"(18.26.5.0/24"or"18.1.2.0/24)’
ip*src*net*not* (18.26.5.0/24*or*18.0.0.0/24)
tcpdump
kernel
**** * * * **** * * * packets filtered packets
ip*src*net*not* (18.26.5.0/24*or*18.0.0.0/24)
tcpdump Kernel module
ld*****12(%ebx),*%eax* test***%eax,*$0x800 jeq****L3 ld*****26(%ebx),*%eax and****%eax,*$0xffffff00 ********...
**** * * * **** * * * packets filtered packets
kernel
Native code
ip*src*net*not* (18.26.5.0/24*or*18.0.0.0/24)
tcpdump Kernel module
ld*****12(%ebx),*%eax* test***%eax,*$0x800 jeq****L3 ld*****26(%ebx),*%eax and****%eax,*$0xffffff00 ********...
**** * * * **** * * * packets filtered packets
kernel
Native code
ip*src*net*not* (18.26.5.0/24*or*18.0.0.0/24)
tcpdump
ip*src*net*not* (18.26.5.0/24*or*18.0.0.0/24)
tcpdump
********ldh****[12] ********jeq****#ETHERTYPE_IP,*L1,*L4 L1:*****ld*****[26] ********and****#0xffffff00 ********jeq****#0x121a0500,*L4,*L2 L2:*****jeq****#0x12010200,*L4,*L3 L3:*****ret****#TRUE L4:*****ret****#0
Bytecode program
ip*src*net*not* (18.26.5.0/24*or*18.0.0.0/24)
tcpdump
********ldh****[12] ********jeq****#ETHERTYPE_IP,*L1,*L4 L1:*****ld*****[26] ********and****#0xffffff00 ********jeq****#0x121a0500,*L4,*L2 L2:*****jeq****#0x12010200,*L4,*L3 L3:*****ret****#TRUE L4:*****ret****#0
Bytecode program
kernel
Host system
ip*src*net*not* (18.26.5.0/24*or*18.0.0.0/24)
tcpdump BPF interpreter
********ldh****[12] ********jeq****#ETHERTYPE_IP,*L1,*L4 L1:*****ld*****[26] ********and****#0xffffff00 ********jeq****#0x121a0500,*L4,*L2 L2:*****jeq****#0x12010200,*L4,*L3 L3:*****ret****#TRUE L4:*****ret****#0
Bytecode program
kernel
Host system
ip*src*net*not* (18.26.5.0/24*or*18.0.0.0/24)
tcpdump BPF interpreter
********ldh****[12] ********jeq****#ETHERTYPE_IP,*L1,*L4 L1:*****ld*****[26] ********and****#0xffffff00 ********jeq****#0x121a0500,*L4,*L2 L2:*****jeq****#0x12010200,*L4,*L3 L3:*****ret****#TRUE L4:*****ret****#0
Bytecode program **** * * * **** * * * packets Inputs to bytecode
kernel
Host system
ip*src*net*not* (18.26.5.0/24*or*18.0.0.0/24)
tcpdump BPF interpreter
********ldh****[12] ********jeq****#ETHERTYPE_IP,*L1,*L4 L1:*****ld*****[26] ********and****#0xffffff00 ********jeq****#0x121a0500,*L4,*L2 L2:*****jeq****#0x12010200,*L4,*L3 L3:*****ret****#TRUE L4:*****ret****#0
Bytecode program **** * * * **** * * * packets Inputs to bytecode Filtered packets
kernel
Host system
ip*src*net*not* (18.26.5.0/24*or*18.0.0.0/24)
tcpdump BPF interpreter
********ldh****[12] ********jeq****#ETHERTYPE_IP,*L1,*L4 L1:*****ld*****[26] ********and****#0xffffff00 ********jeq****#0x121a0500,*L4,*L2 L2:*****jeq****#0x12010200,*L4,*L3 L3:*****ret****#TRUE L4:*****ret****#0
Bytecode program **** * * * **** * * * packets Inputs to bytecode Filtered packets
kernel
Host system
✔ Flexibility
ip*src*net*not* (18.26.5.0/24*or*18.0.0.0/24)
tcpdump BPF interpreter
********ldh****[12] ********jeq****#ETHERTYPE_IP,*L1,*L4 L1:*****ld*****[26] ********and****#0xffffff00 ********jeq****#0x121a0500,*L4,*L2 L2:*****jeq****#0x12010200,*L4,*L3 L3:*****ret****#TRUE L4:*****ret****#0
Bytecode program **** * * * **** * * * packets Inputs to bytecode Filtered packets
kernel
Host system
✔ Flexibility ✔ Performance —— no IPC & context switch overhead
ip*src*net*not* (18.26.5.0/24*or*18.0.0.0/24)
tcpdump BPF interpreter
********ldh****[12] ********jeq****#ETHERTYPE_IP,*L1,*L4 L1:*****ld*****[26] ********and****#0xffffff00 ********jeq****#0x121a0500,*L4,*L2 L2:*****jeq****#0x12010200,*L4,*L3 L3:*****ret****#TRUE L4:*****ret****#0
Bytecode program **** * * * **** * * * packets Inputs to bytecode Filtered packets
kernel
Host system
✔ Flexibility ✔ Performance —— no IPC & context switch overhead ✔ “Security” —— no direct control of the real machine
ip*src*net*not* (18.26.5.0/24*or*18.0.0.0/24)
tcpdump BPF interpreter
********ldh****[12] ********jeq****#ETHERTYPE_IP,*L1,*L4 L1:*****ld*****[26] ********and****#0xffffff00 ********jeq****#0x121a0500,*L4,*L2 L2:*****jeq****#0x12010200,*L4,*L3 L3:*****ret****#TRUE L4:*****ret****#0
Bytecode program **** * * * **** * * * packets Inputs to bytecode Filtered packets
kernel
Host system
ip*src*net*not* (18.26.5.0/24*or*18.0.0.0/24)
tcpdump BPF interpreter
********ldh****[12] ********jeq****#ETHERTYPE_IP,*L1,*L4 L1:*****ld*****[26] ********and****#0xffffff00 ********jeq****#0x121a0500,*L4,*L2 L2:*****jeq****#0x12010200,*L4,*L3 L3:*****ret****#TRUE L4:*****ret****#0
Bytecode program **** * * * **** * * * packets Inputs to bytecode Filtered packets
kernel
Host system
Untrusted bytecode
********!@#S****[238472398] *********$&$s****#934dead L1:*****@#&#$(&@#$*#@$ ********kill****[xxx] ********#@!&#*@#**!*&#$*$*# L2:*****... ********ret*****#deadbeaf *********#(@&*&*$#!@&(&
Bytecode program
ip*src*net*not* (18.26.5.0/24*or*18.0.0.0/24)
tcpdump BPF interpreter
********ldh****[12] ********jeq****#ETHERTYPE_IP,*L1,*L4 L1:*****ld*****[26] ********and****#0xffffff00 ********jeq****#0x121a0500,*L4,*L2 L2:*****jeq****#0x12010200,*L4,*L3 L3:*****ret****#TRUE L4:*****ret****#0
Bytecode program **** * * * **** * * * packets Inputs to bytecode Filtered packets
kernel
Host system **** * * * **** * * * packets Inputs to bytecode
Untrusted input Untrusted bytecode
********!@#S****[238472398] *********$&$s****#934dead L1:*****@#&#$(&@#$*#@$ ********kill****[xxx] ********#@!&#*@#**!*&#$*$*# L2:*****... ********ret*****#deadbeaf *********#(@&*&*$#!@&(&
Bytecode program
ip*src*net*not* (18.26.5.0/24*or*18.0.0.0/24)
tcpdump BPF interpreter
********ldh****[12] ********jeq****#ETHERTYPE_IP,*L1,*L4 L1:*****ld*****[26] ********and****#0xffffff00 ********jeq****#0x121a0500,*L4,*L2 L2:*****jeq****#0x12010200,*L4,*L3 L3:*****ret****#TRUE L4:*****ret****#0
Bytecode program **** * * * **** * * * packets Inputs to bytecode Filtered packets
kernel
Host system **** * * * **** * * * packets Inputs to bytecode
Untrusted input Untrusted bytecode
********!@#S****[238472398] *********$&$s****#934dead L1:*****@#&#$(&@#$*#@$ ********kill****[xxx] ********#@!&#*@#**!*&#$*$*# L2:*****... ********ret*****#deadbeaf *********#(@&*&*$#!@&(&
Bytecode program
ip*src*net*not* (18.26.5.0/24*or*18.0.0.0/24)
tcpdump BPF interpreter
********ldh****[12] ********jeq****#ETHERTYPE_IP,*L1,*L4 L1:*****ld*****[26] ********and****#0xffffff00 ********jeq****#0x121a0500,*L4,*L2 L2:*****jeq****#0x12010200,*L4,*L3 L3:*****ret****#TRUE L4:*****ret****#0
Bytecode program **** * * * **** * * * packets Inputs to bytecode Filtered packets
kernel
Host system **** * * * **** * * * packets Inputs to bytecode
Untrusted input Untrusted bytecode
********!@#S****[238472398] *********$&$s****#934dead L1:*****@#&#$(&@#$*#@$ ********kill****[xxx] ********#@!&#*@#**!*&#$*$*# L2:*****... ********ret*****#deadbeaf *********#(@&*&*$#!@&(&
Bytecode program
affecting the host system
affecting the host system
(CVE-2011-2213)
(CVE-2011-0226)
$*ss*‘...’
"""""sge""""21,"L1,"rej""";"02"04"... L1:""sge""1024,"L2,"acc""";"02"04"... L2:""jmp""rej""""""""""""";"01"04"... acc:"nop"""""""""""""""""";"00"04 rej:
Userspace filter code
$*ss*‘...’
suspicious files suspicious files Socket state (trusted)
"""""sge""""21,"L1,"rej""";"02"04"... L1:""sge""1024,"L2,"acc""";"02"04"... L2:""jmp""rej""""""""""""";"01"04"... acc:"nop"""""""""""""""""";"00"04 rej:
Userspace filter code
$*ss*‘...’
struct"inet_diag_bc_op"{"""""//"instruction"header """"unsigned"char"""opcode;""//"opcode """"unsigned"char"""oplen;"""//"instruction"length };
suspicious files suspicious files Socket state (trusted)
"""""sge""""21,"L1,"rej""";"02"04"... L1:""sge""1024,"L2,"acc""";"02"04"... L2:""jmp""rej""""""""""""";"01"04"... acc:"nop"""""""""""""""""";"00"04 rej:
Userspace filter code
$*ss*‘...’
struct"inet_diag_bc_op"{"""""//"instruction"header """"unsigned"char"""opcode;""//"opcode """"unsigned"char"""oplen;"""//"instruction"length };
suspicious files suspicious files Socket state (trusted)
"""""sge""""21,"L1,"rej""";"02"04"... L1:""sge""1024,"L2,"acc""";"02"04"... L2:""jmp""rej""""""""""""";"01"04"... acc:"nop"""""""""""""""""";"00"04 rej:
Userspace filter code
$*ss*‘...’
struct"inet_diag_bc_op"{"""""//"instruction"header """"unsigned"char"""opcode;""//"opcode """"unsigned"char"""oplen;"""//"instruction"length };
suspicious files suspicious files Socket state (trusted)
"""""sge""""21,"L1,"rej""";"02"04"... L1:""sge""1024,"L2,"acc""";"02"04"... L2:""jmp""rej""""""""""""";"01"04"... acc:"nop"""""""""""""""""";"00"04 rej:
Userspace filter code
$*ss*‘...’
//"validate"bytecode const"void"*bc"="bytecode; while"(len">"0)"{ """"struct"inet_diag_bc_op"*op"="bc; """"... """"bc"+="opP>oplen; """"len"P="opP>oplen; }
struct"inet_diag_bc_op"{"""""//"instruction"header """"unsigned"char"""opcode;""//"opcode """"unsigned"char"""oplen;"""//"instruction"length };
suspicious files suspicious files Socket state (trusted)
"""""sge""""21,"L1,"rej""";"02"04"... L1:""sge""1024,"L2,"acc""";"02"04"... L2:""jmp""rej""""""""""""";"01"04"... acc:"nop"""""""""""""""""";"00"04 rej:
Userspace filter code
Infinite loop when
$*ss*‘...’ 02"00 02"00 01"00 00"00
//"validate"bytecode const"void"*bc"="bytecode; while"(len">"0)"{ """"struct"inet_diag_bc_op"*op"="bc; """"... """"bc"+="opP>oplen; """"len"P="opP>oplen; }
struct"inet_diag_bc_op"{"""""//"instruction"header """"unsigned"char"""opcode;""//"opcode """"unsigned"char"""oplen;"""//"instruction"length };
suspicious files suspicious files Socket state (trusted)
"""""sge""""21,"L1,"rej""";"02"04"... L1:""sge""1024,"L2,"acc""";"02"04"... L2:""jmp""rej""""""""""""";"01"04"... acc:"nop"""""""""""""""""";"00"04 rej:
Userspace filter code
Infinite loop when
$*ss*‘...’ 02"00 02"00 01"00 00"00
//"validate"bytecode const"void"*bc"="bytecode; while"(len">"0)"{ """"struct"inet_diag_bc_op"*op"="bc; """"... """"bc"+="opP>oplen; """"len"P="opP>oplen; }
struct"inet_diag_bc_op"{"""""//"instruction"header """"unsigned"char"""opcode;""//"opcode """"unsigned"char"""oplen;"""//"instruction"length };
suspicious files suspicious files Socket state (trusted)
"""""sge""""21,"L1,"rej""";"02"04"... L1:""sge""1024,"L2,"acc""";"02"04"... L2:""jmp""rej""""""""""""";"01"04"... acc:"nop"""""""""""""""""";"00"04 rej:
Userspace filter code
+"""if"(opP>oplen"<"min_len)"//"min_len"is"at"least"4 +"""""""return"PEINVAL;
Infinite loop when
$*ss*‘...’ 02"00 02"00 01"00 00"00
//"validate"bytecode const"void"*bc"="bytecode; while"(len">"0)"{ """"struct"inet_diag_bc_op"*op"="bc; """"... """"bc"+="opP>oplen; """"len"P="opP>oplen; }
(CVE-2011-2213)
(CVE-2011-0226)
%a"="load"i64*"inttoptr"i64"0"to"i64* %b"="load"i64*"inttoptr"i64"8"to"i64* %r"="sdiv"i64"%a,"%b ...
Bytecode signature
Cloud
10000000"00000000 11111111"11111111 ..."...
suspicious files suspicious files Suspicious local file
%a"="load"i64*"inttoptr"i64"0"to"i64* %b"="load"i64*"inttoptr"i64"8"to"i64* %r"="sdiv"i64"%a,"%b ...
Bytecode signature
Cloud
switch"(opcode)"{ .... case"OP_SDIV: { """"int64_t"a"="BINOPS(0);"//"dividend """"int64_t"b"="BINOPS(1);"//"divisor """"if"(b"=="0"||"(a"=="P1"&&"b"=="INT64_MIN)) """"""""return"CL_EBYTECODE; """"valueP>v"="a"/"b; } }
Interpreter code
10000000"00000000 11111111"11111111 ..."...
suspicious files suspicious files Suspicious local file
%a"="load"i64*"inttoptr"i64"0"to"i64* %b"="load"i64*"inttoptr"i64"8"to"i64* %r"="sdiv"i64"%a,"%b ...
Bytecode signature
Cloud
switch"(opcode)"{ .... case"OP_SDIV: { """"int64_t"a"="BINOPS(0);"//"dividend """"int64_t"b"="BINOPS(1);"//"divisor """"if"(b"=="0"||"(a"=="P1"&&"b"=="INT64_MIN)) """"""""return"CL_EBYTECODE; """"valueP>v"="a"/"b; } }
Interpreter code
10000000"00000000 11111111"11111111 ..."...
suspicious files suspicious files Suspicious local file
%a"="load"i64*"inttoptr"i64"0"to"i64* %b"="load"i64*"inttoptr"i64"8"to"i64* %r"="sdiv"i64"%a,"%b ...
Bytecode signature
Cloud
switch"(opcode)"{ .... case"OP_SDIV: { """"int64_t"a"="BINOPS(0);"//"dividend """"int64_t"b"="BINOPS(1);"//"divisor """"if"(b"=="0"||"(a"=="P1"&&"b"=="INT64_MIN)) """"""""return"CL_EBYTECODE; """"valueP>v"="a"/"b; } }
Interpreter code
10000000"00000000 11111111"11111111 ..."...
suspicious files suspicious files Suspicious local file
%a"="load"i64*"inttoptr"i64"0"to"i64* %b"="load"i64*"inttoptr"i64"8"to"i64* %r"="sdiv"i64"%a,"%b ...
Bytecode signature
Might trap on a/0 and INT64_MIN*/*^1
Cloud
switch"(opcode)"{ .... case"OP_SDIV: { """"int64_t"a"="BINOPS(0);"//"dividend """"int64_t"b"="BINOPS(1);"//"divisor """"if"(b"=="0"||"(a"=="P1"&&"b"=="INT64_MIN)) """"""""return"CL_EBYTECODE; """"valueP>v"="a"/"b; } }
Interpreter code
10000000"00000000 11111111"11111111 ..."...
suspicious files suspicious files Suspicious local file
%a"="load"i64*"inttoptr"i64"0"to"i64* %b"="load"i64*"inttoptr"i64"8"to"i64* %r"="sdiv"i64"%a,"%b ...
Bytecode signature
Might trap on a/0 and INT64_MIN*/*^1 WRONG! Should swap a and b
Cloud
(CVE-2011-2213)
(CVE-2011-0226)
CVE-2011-0226
CVE-2011-0226
push"0xfea50000"""";"nargs"="P347 push"0x2a"""""""""";"subroutine"num"="42 callothersubr"""""";"call"custom"function ..."...
Malicious PDF file with embedded T1 font
CVE-2011-0226
push"0xfea50000"""";"nargs"="P347 push"0x2a"""""""""";"subroutine"num"="42 callothersubr"""""";"call"custom"function ..."...
Malicious PDF file with embedded T1 font
CVE-2011-0226
struct"T1_DecoderRec"{""""""""""""""//"T1"VM"state """"FT_Long"""stack[MAX_OPERANDS];""//"execution"stack """"FT_Long*""top;""""""""""""""""""//"stack"pointer """".... """"T1_Decoder_Callback"""parse_callback;"//"func"pointer };
push"0xfea50000"""";"nargs"="P347 push"0x2a"""""""""";"subroutine"num"="42 callothersubr"""""";"call"custom"function ..."...
Malicious PDF file with embedded T1 font
CVE-2011-0226
struct"T1_DecoderRec"{""""""""""""""//"T1"VM"state """"FT_Long"""stack[MAX_OPERANDS];""//"execution"stack """"FT_Long*""top;""""""""""""""""""//"stack"pointer """".... """"T1_Decoder_Callback"""parse_callback;"//"func"pointer };
push"0xfea50000"""";"nargs"="P347 push"0x2a"""""""""";"subroutine"num"="42 callothersubr"""""";"call"custom"function ..."...
Malicious PDF file with embedded T1 font
CVE-2011-0226
struct"T1_DecoderRec"{""""""""""""""//"T1"VM"state """"FT_Long"""stack[MAX_OPERANDS];""//"execution"stack """"FT_Long*""top;""""""""""""""""""//"stack"pointer """".... """"T1_Decoder_Callback"""parse_callback;"//"func"pointer };
push"0xfea50000"""";"nargs"="P347 push"0x2a"""""""""";"subroutine"num"="42 callothersubr"""""";"call"custom"function ..."...
Malicious PDF file with embedded T1 font
CVE-2011-0226
struct"T1_DecoderRec"{""""""""""""""//"T1"VM"state """"FT_Long"""stack[MAX_OPERANDS];""//"execution"stack """"FT_Long*""top;""""""""""""""""""//"stack"pointer """".... """"T1_Decoder_Callback"""parse_callback;"//"func"pointer };
push"0xfea50000"""";"nargs"="P347 push"0x2a"""""""""";"subroutine"num"="42 callothersubr"""""";"call"custom"function ..."...
Malicious PDF file with embedded T1 font
//"execute"callothersubr case"CALL_OTHER_SUBR: """"//"dispatch"and"call"subroutines """"... """"//"pop"out"arguments"from"the"stack """"decoderP>top"P="nargs;
CVE-2011-0226
struct"T1_DecoderRec"{""""""""""""""//"T1"VM"state """"FT_Long"""stack[MAX_OPERANDS];""//"execution"stack """"FT_Long*""top;""""""""""""""""""//"stack"pointer """".... """"T1_Decoder_Callback"""parse_callback;"//"func"pointer };
Did not validate nargs is in range
push"0xfea50000"""";"nargs"="P347 push"0x2a"""""""""";"subroutine"num"="42 callothersubr"""""";"call"custom"function ..."...
Malicious PDF file with embedded T1 font
//"execute"callothersubr case"CALL_OTHER_SUBR: """"//"dispatch"and"call"subroutines """"... """"//"pop"out"arguments"from"the"stack """"decoderP>top"P="nargs;
CVE-2011-0226
struct"T1_DecoderRec"{""""""""""""""//"T1"VM"state """"FT_Long"""stack[MAX_OPERANDS];""//"execution"stack """"FT_Long*""top;""""""""""""""""""//"stack"pointer """".... """"T1_Decoder_Callback"""parse_callback;"//"func"pointer };
Did not validate nargs is in range
push"0xfea50000"""";"nargs"="P347 push"0x2a"""""""""";"subroutine"num"="42 callothersubr"""""";"call"custom"function ..."...
Malicious PDF file with embedded T1 font
//"execute"callothersubr case"CALL_OTHER_SUBR: """"//"dispatch"and"call"subroutines """"... """"//"pop"out"arguments"from"the"stack """"decoderP>top"P="nargs;
CVE-2011-0226
struct"T1_DecoderRec"{""""""""""""""//"T1"VM"state """"FT_Long"""stack[MAX_OPERANDS];""//"execution"stack """"FT_Long*""top;""""""""""""""""""//"stack"pointer """".... """"T1_Decoder_Callback"""parse_callback;"//"func"pointer };
Did not validate nargs is in range Overwrite function pointer
push"0xfea50000"""";"nargs"="P347 push"0x2a"""""""""";"subroutine"num"="42 callothersubr"""""";"call"custom"function ..."...
Malicious PDF file with embedded T1 font
//"execute"callothersubr case"CALL_OTHER_SUBR: """"//"dispatch"and"call"subroutines """"... """"//"pop"out"arguments"from"the"stack """"decoderP>top"P="nargs;
host system
host system
attack vectors there could be
attack vectors there could be
Feature set Potential attack vectors
Arithmetic operations Div-by-zero, integer overflow Loops (backward jumps) Infinite loops, DoS Function calls Infinite recursion, stack overflow External calls to the host Arbitrary code execution Register file or scratch memory Information leak
attack vectors there could be
Feature set Potential attack vectors
Arithmetic operations Div-by-zero, integer overflow Loops (backward jumps) Infinite loops, DoS Function calls Infinite recursion, stack overflow External calls to the host Arbitrary code execution Register file or scratch memory Information leak
necessary
limit to input and output
Embedded interpreter General-purpose bytecode (e.g. Java)
Embedded interpreter General-purpose bytecode (e.g. Java)
level packet capture. USENIX ATC ’93.
http://blog.clamav.net/2011/11/bytecode-signatures-for-polymorphic.html.
http://blog.cmpxchg8b.com/2012/09/fun-with-constrained-programming.html.
http://esec-lab.sogeti.com/post/Analysis-of-the-jailbreakme-v3-font-exploit.
media.blackhat.com/bh-us-11/Slaviero/BH_US_11_Slaviero_Sour_Pickles_WP .pdf.
Trojan and exploit techniques with no native executable code. USENIX WOOT ’11.
IEEE S&P ’12.
Haogang Chen, Cody Cutler, Taesoo Kim, Yandong Mao, Xi Wang, Nickolai Zeldovich and M. Frans Kaashoek MIT CSAIL