abstract self modifying machines
play

Abstract Self Modifying Machines Hubert Godfroy joint work with - PowerPoint PPT Presentation

Abstract Self Modifying Machines Hubert Godfroy joint work with Jean-Yves Marion Loria Nancy October 14, 2014 1/32 Plan Introduction Framework Applications 2/32 Plan Introduction Framework Applications 3/32 Program? Data? A


  1. Abstract Self Modifying Machines Hubert Godfroy joint work with Jean-Yves Marion Loria Nancy October 14, 2014 1/32

  2. Plan Introduction Framework Applications 2/32

  3. Plan Introduction Framework Applications 3/32

  4. Program? Data? ◮ A program is something which can be executed. ◮ A data is something which can be read and write 4/32

  5. Program? Data? ◮ A program is something which can be executed. ◮ A data is something which can be read and write ◮ In most langages, programs are distinct from data. ◮ Example : C, JAVA, OCaml 4/32

  6. Program? Data? ◮ A program is something which can be executed. ◮ A data is something which can be read and write ◮ In most langages, programs are distinct from data. ◮ Example : C, JAVA, OCaml ◮ There is exceptions... ◮ Programs with exec function have self-modifying behaviors ◮ Example : Python 4/32

  7. Program? Data? ◮ A program is something which can be executed. ◮ A data is something which can be read and write ◮ In most langages, programs are distinct from data. ◮ Example : C, JAVA, OCaml ◮ There is exceptions... ◮ Programs with exec function have self-modifying behaviors ◮ Example : Python Low level case: nothing is forbidden! ◮ Programs and data are totally indistinguishable ◮ They belong to the same space (memory) 4/32

  8. Example PoïPoï 1 move 10 2 2 jz � 10 � 6 move ( 10 − � 10 � ) ( � 10 − � 10 �� ) − 42 ) 3 4 move 10 ( � 10 � − 1 ) 5 jump 2 6 jump 8 7 stop 8 ( E ( print hello world ) + 42 ) 9 ( E ( jump 7 ) + 42 ) 10 jump 1 5/32

  9. Example PoïPoï 1 move 10 2 2 jz � 10 � 6 3 move ( 10 − � 10 � ) ( � 10 − � 10 �� ) − 42 4 move 10 ( � 10 � − 1 ) 5 jump 2 6 jump 8 7 stop ( E ( print hello world ) + 42 ) 8 9 ( E ( jump 7 ) + 42 ) 10 jump 1 5/32

  10. Example 1 move 10 2 2 jz � 10 � 6 3 move ( 10 − � 10 � ) ( � 10 − � 10 �� ) − 42 4 move 10 ( � 10 � − 1 ) 5 jump 2 6 jump 8 7 stop ( E ( print hello world ) + 42 ) 8 9 ( E ( jump 7 ) + 42 ) 10 jump 1 5/32

  11. Example PoïPoï 1 move 10 2 2 jz � 10 � 6 3 move ( 10 − � 10 � ) ( � 10 − � 10 �� ) − 42 4 move 10 ( � 10 � − 1 )) 5 jump 2 6 jump 8 7 stop ( E ( print hello world ) + 42 ) 8 9 ( E ( jump 7 ) + 42 ) 10 2 5/32

  12. Example 1 move 10 2 2 jz � 10 � 6 3 move ( 10 − � 10 � ) ( � 10 − � 10 �� ) − 42 4 move 10 ( � 10 � − 1 ) 5 jump 2 6 jump 8 7 stop ( E ( print hello world ) + 42 ) 8 9 ( E ( jump 7 ) + 42 ) 10 2 5/32

  13. Example PoïPoï 1 move 10 2 2 jz � 10 � 6 3 move ( 10 − � 10 � ) ( � 10 − � 10 �� ) − 42 4 move 10 ( � 10 � − 1 ) 5 jump 2 6 jump 8 7 stop 8 print hello world 9 ( E ( jump 7 ) + 42 ) 10 2 5/32

  14. Example 1 move 10 2 2 jz � 10 � 6 3 move ( 10 − � 10 � ) ( � 10 − � 10 �� ) − 42 4 move 10 ( � 10 � − 1 ) 5 jump 2 6 jump 8 7 stop 8 print hello world 9 ( E ( jump 7 ) + 42 ) 10 1 5/32

  15. Example PoïPoï 1 move 10 2 2 jz � 10 � 6 3 move ( 10 − � 10 � ) ( � 10 − � 10 �� ) − 42 4 move 10 ( � 10 � − 1 ) 5 jump 2 6 jump 8 7 stop 8 print hello world 9 jump 7 10 0 5/32

  16. Example 1 move 10 2 2 jz � 10 � 6 3 move ( 10 − � 10 � ) ( � 10 − � 10 �� ) − 42 4 move 10 ( � 10 � − 1 ) 5 jump 2 6 jump 8 7 stop 8 print hello world 9 jump 7 10 0 5/32

  17. Example PoïPoï 1 move 10 2 2 jz � 10 � 6 3 move ( 10 − � 10 � ) ( � 10 − � 10 �� ) − 42 4 move 10 ( � 10 � − 1 ) 5 jump 2 6 jump 8 7 stop 8 print hello world 9 jump 7 10 0 5/32

  18. Example 1 move 10 2 2 jz � 10 � 6 3 move ( 10 − � 10 � ) ( � 10 − � 10 �� ) − 42 4 move 10 ( � 10 � − 1 ) 5 jump 2 6 jump 8 7 stop 8 print hello world 9 jump 7 10 0 5/32

  19. Example PoïPoï 1 move 10 2 2 jz � 10 � 6 3 move ( 10 − � 10 � ) ( � 10 − � 10 �� ) − 42 4 move 10 ( � 10 � − 1 ) 5 jump 2 6 jump 8 7 stop 8 print hello world 9 jump 7 10 0 5/32

  20. General problematics Compilation & certification ◮ From non SM programs to SM programs (obfuscation/optimisation) ◮ Certify compilation 6/32

  21. General problematics Compilation & certification ◮ From non SM programs to SM programs (obfuscation/optimisation) ◮ Certify compilation Recover high-level semantics from low-level SM semantics ◮ Recover non SM program from SM program... ◮ ...wrt existing models of self-modification (wave semantics) 6/32

  22. General problematics Compilation & certification ◮ From non SM programs to SM programs (obfuscation/optimisation) ◮ Certify compilation Recover high-level semantics from low-level SM semantics ◮ Recover non SM program from SM program... ◮ ...wrt existing models of self-modification (wave semantics) Program abstraction ◮ Find abstract model specifically taking about self-modification. 6/32

  23. Plan Introduction Framework Applications 7/32

  24. Current frameworks ◮ Turing machine ◮ RAM (Cook & Reckhow, 1973) ◮ Cellular automaton (Neumann, 1966) ◮ Blob (Jones, 2010) ◮ RASP (Elgot & Robinson, 1964) ◮ SRM (Marion, 2012) 8/32

  25. Language ASM 2 Language over data in D , addresses in A and registers in R : ∀ r ∈ R , � r � : A → D Abstract machine ◮ Register pointer: RP ∈ R ◮ Instruction pointer: IP ∈ A ◮ Executable zone: X ∈ ℘ ( R ) r 1 d 1 1 · ... · d 1 r 5 d 5 1 · ... · d 5 n n r 2 d 2 1 · ... · d 2 r 6 d 6 1 · ... · d 6 n n r 3 d 3 1 · ... · d 3 r 7 d 7 1 · ... · d 7 n n d 4 1 · ... · d 4 d 8 1 · ... · d 8 r 4 r 8 n n X D Memory 9/32

  26. Instruction The set of data D contains codes of the following instructions: Instruction Meaning move r, d Write the data d at the end of D [ r ] input r Write the top of the input at the end of D [ r ] pop r Pop the data on the top of D [ r ] jump a Go to the instruction at address a case r Conditional jump depending on D [ r ] exec r Control transfer to register RP = r and IP = 0 activate r Activate D [ r ] inactivate r Inactivate X [ r ] 10/32

  27. Instruction activate r u r 1 u 1 r 4 u 4 r 2 u 2 r 5 u 5 r 3 u 3 r 6 u 6 X D = r 3 RP � RP � IP = activate r 11/32

  28. Instruction activate r u r 1 u 1 r 4 u 4 r 2 u 2 r 5 u 5 r 3 u 3 r 6 u 6 X D = r 3 RP � RP � IP = activate r 11/32

  29. Instruction inactivate r u r 1 u 1 r 4 u 4 r 2 u 2 r 5 u 5 r 3 u 3 r 6 u 6 X D = r 3 RP � RP � IP = inactivate r 12/32

  30. Instruction inactivate r u r 1 u 1 r 4 u 4 r 2 u 2 r 5 u 5 r 3 u 3 r 6 u 6 X D = r 3 RP � RP � IP = inactivate r 12/32

  31. Instruction exec r 1 u 1 r 5 u 5 r 2 u 2 r 6 u 6 r 3 u 3 r 7 u 7 r 4 u 4 r 8 u 8 X D = r 3 RP � RP � IP = exec r 13/32

  32. Instruction exec r 1 u 1 r 5 u 5 r 2 u 2 r 6 u 6 r 3 u 3 r 7 u 7 r 4 u 4 r 8 u 8 X D = r 3 RP � RP � IP = exec r 13/32

  33. Example: decrypting code 1 move 10 2 2 jz � 10 � 6 move ( 10 − � 10 � ) ( � 10 − � 10 �� ) − 42 3 4 move 10 ( � 10 � − 1 ) 5 jump 2 6 jump 8 7 stop 8 ( E ( print hello world ) + 42 ) 9 ( E ( jump 7 ) + 42 ) 10 jump 1 14/32

  34. Example: decrypting code 1 move 10 2 2 jz � 10 � 6 3 move ( 10 − � 10 � ) ( � 10 − � 10 �� ) − 42 4 move 10 ( � 10 � − 1 ) 5 jump 2 6 jump 8 7 stop ( E ( print hello world ) + 42 ) 8 9 ( E ( jump 7 ) + 42 ) 10 jump 1 14/32

  35. Cinematic a 1 inactivate r 4 a 2 move r 4 2 a 3 pop r 4 a 4 case r 4 a 5 jump a 7 a 6 jump a 11 r 1 a 7 move r 3 � r 3 | 10 − � r 4 | 10 �� − 42 a 8 pop r 3 a 9 move r 4 � r 4 | 10 � − 1 a 10 pop r 4 a 11 jump a 4 a 12 activate r 4 a 13 exec r 4 a 15 ( E ( print hello world ) + 42 ) r 3 ( E ( exec r 2 ) + 42 ) a 16 r 2 a 14 stop r 4 a 17 exec r 1 X D 15/32

  36. Cinematic a 1 inactivate r 4 a 2 move r 4 2 a 3 pop r 4 a 4 case r 4 a 5 jump a 7 a 6 jump a 11 r 1 a 7 move r 3 � r 3 | 10 − � r 4 | 10 �� − 42 a 8 pop r 3 a 9 move r 4 � r 4 | 10 � − 1 a 10 pop r 4 a 11 jump a 4 a 12 activate r 4 a 13 exec r 4 a 15 ( E ( print hello world ) + 42 ) r 3 ( E ( exec r 2 ) + 42 ) a 16 r 2 a 14 stop r 4 a 17 exec r 1 X D 15/32

  37. Cinematic a 1 inactivate r 4 a 2 move r 4 2 a 3 pop r 4 a 4 case r 4 a 5 jump a 7 a 6 jump a 11 r 1 a 7 move r 3 � r 3 | 10 − � r 4 | 10 �� − 42 a 8 pop r 3 a 9 move r 4 � r 4 | 10 � − 1 a 10 pop r 4 a 11 jump a 4 a 12 activate r 4 a 13 exec r 4 a 15 ( E ( print hello world ) + 42 ) r 3 ( E ( exec r 2 ) + 42 ) a 16 r 2 a 14 stop r 4 a 17 exec r 1 X D 15/32

  38. Cinematic a 1 inactivate r 4 a 2 move r 4 2 a 3 pop r 4 a 4 case r 4 a 5 jump a 7 a 6 jump a 11 r 1 a 7 move r 3 � r 3 | 10 − � r 4 | 10 �� − 42 a 8 pop r 3 a 9 move r 4 � r 4 | 10 � − 1 a 10 pop r 4 a 11 jump a 4 a 12 activate r 4 a 13 exec r 4 a 15 print hello world r 3 a 16 exec r 2 r 2 a 14 stop r 4 a 17 0 X D 15/32

  39. Cinematic a 1 inactivate r 4 a 2 move r 4 2 a 3 pop r 4 a 4 case r 4 a 5 jump a 7 a 6 jump a 11 r 1 a 7 move r 3 � r 3 | 10 − � r 4 | 10 �� − 42 a 8 pop r 3 a 9 move r 4 � r 4 | 10 � − 1 a 10 pop r 4 a 11 jump a 4 a 12 activate r 4 a 13 exec r 4 a 15 print hello world r 3 a 16 exec r 2 r 2 a 14 stop r 4 a 17 0 X D 15/32

Recommend


More recommend