SlideShare a Scribd company logo
Wire - A Formal Intermediate Language for Binary Analysis
•

•
    •
    •
    •

•

    •
    •
    •
•
    –
    –

•
    –

    –

    –
•


•


•




•
i := 0
        L1:
              if i >= 10 goto L2
•             t0 := i*I
    –         t1 := &b
              t2 := t1 + I
              *t2 := t0
•             i := i + 1
    –         goto L1
        L2:
    –

•
    –
    –
    –

•
    –
    –
•
    –
    –
•
    –
    –
    –
•
•


•

•

    –

•

•
Instructions   m       ::=   *(r3) := r1
                                                                                      | r3 := (*r1)
                                                                                      | r3 := r1
                                                                                      | r3 := n
                                                                                      | r3 := uop r1
                                                                                      | r3 := r1 bop r2
Program       p       ::=      pi|i                                                   | r3 := r1 bop n
                                                                                      | mkbool r1 ucond
Instruction   i       ::=      m| m t                                                 | mkbool r1 bcond r2
                                                                                      | nop
Type          t       ::=      u8_t                                                   | halt
                               | u16_t                                                | label l
                               | u32_t                                                | jmp l
                               | s8_t                                                 | ijmp r
                               | s16_t                                                | if r1 cond1 jmp l
                               | s32_t                                                | if r1 cond2 r2 jmp l
                                                                                      | lcall s
                                                                                      | cast(r1, t)
Instructions          I         ::=      ni                                          | r3 := getpc()
Heap                  H        ::=       nxn  n                                      | r3 := returnaddress()
Memory                M        ::=       nn                                          | pusharg(n, r)
Register              R        ::=       rn                                          | r3 := malloc(r)
Labels                L        ::=       l  pc                                       | free(r)
AllocAMemory          V        ::=       nxnn                                        | r3 := alloca(r)

Instructions: (maps instruction number to instruction)   Operations     uop     ::=   -|~|!
Heap: (maps heap address and memory size to non                         bop     ::=   +,-,*,/,%,>>,<<,|,&,^
        overlapping memory addresses)                    Conditions     ucond   ::=   == 0|!= 0
Register: (maps register name to numeric value)                         bcond   ::=   ==|!= | >|>=|<|<=
Memory: (maps address to numeric value)                  Operands       v       ::=   n (an integer literal)
Labels: (maps label to instruction address pc)                                        r (a register)
AllocAMemory: (maps alloca address and memory size                                    l (a label)
                  to non overlapping memory addresses)                                s (a symbol)
•
•
•
•
•
•
•
    –
    –
    –
•
Wire - A Formal Intermediate Language for Binary Analysis
•


•



•
•
•
•

        
                                       add $50,%eax
            mov $0,%eax
                                       sub $50,%eax
                                       mov $0,%eax
    
               ASSIGNC $0,-,%eax



               BOPCADD %eax,$50,%eax

               BOPCSUB %eax,%50,%eax

               ASSIGNC $0,,%eax
•


•


•
Wire - A Formal Intermediate Language for Binary Analysis
•


    mov $2,%eax                mov $1,%ebx
    mov $1,%ebx                mov $2,%eax
    add %eax,%ebx              add %eax,%ebx

       ASSIGNC $0x2,,%eax

       ASSIGNC $1,,%ebx

       BOPADD %ebx,%eax,%ebx


       ASSIGNC $0x1,-,%ebx

       ASSIGNC $2,-,%eax

       BOPADD %ebx,%eax,%ebx
Wire - A Formal Intermediate Language for Binary Analysis
•


                          xor %eax,%eax
    xor %eax,%eax
                          jnz $0x80482000
    mov $2,%eax
                          mov $2,%eax



      BOPXOR %eax,%eax,%eax

      UMKBOOLIsZero %eax,,%zf

      ASSIGNC $2,-,%eax


     BOPXOR %eax,%eax,%eax

     UMKBOOLIsZero %eax,,%zf

     UCJMPIsNotZero %zf,,$target

     ASSIGNC $2,-,%eax
Wire - A Formal Intermediate Language for Binary Analysis
•

•


•

More Related Content

DOC
2 senarai rumus add maths k1 trial spm sbp 2010
DOC
2 senarai rumus add maths k2 trial spm sbp 2010
PDF
PDF
Rcpp11 genentech
PDF
Rcpp11 useR2014
PDF
R/C++ talk at earl 2014
2 senarai rumus add maths k1 trial spm sbp 2010
2 senarai rumus add maths k2 trial spm sbp 2010
Rcpp11 genentech
Rcpp11 useR2014
R/C++ talk at earl 2014

Viewers also liked (7)

PDF
A WHIRLWIND TOUR OF ACADEMIC TECHNIQUES FOR REAL-WORLD SECURITY RESEARCHERS
PDF
Auditing the Opensource Kernels
PDF
新浪内部对腾讯公司的深度解析
PPTX
Detecting Bugs in Binaries Using Decompilation and Data Flow Analysis
PDF
異種・協調・分散ロボットに関する研究
PDF
微博合作介绍 V0.2
PPTX
Moto%20 x%20project
A WHIRLWIND TOUR OF ACADEMIC TECHNIQUES FOR REAL-WORLD SECURITY RESEARCHERS
Auditing the Opensource Kernels
新浪内部对腾讯公司的深度解析
Detecting Bugs in Binaries Using Decompilation and Data Flow Analysis
異種・協調・分散ロボットに関する研究
微博合作介绍 V0.2
Moto%20 x%20project
Ad

Similar to Wire - A Formal Intermediate Language for Binary Analysis (20)

PPTX
Predication
PDF
KEY
Coqによる暗号アルゴリズムの実装の安全性検証
PDF
optimization c code on blackfin
PDF
Microcontroller Instruction Set atmel
PDF
At c51ism
PDF
Tap lenh ho_8051 (1)
PDF
Tap Lenh Ho 8051
PPT
C for Microcontrollers
PDF
8086 labmanual
PDF
8086 labmanual
PPT
PDF
Bristol 2009 q1_wright_steve
PPTX
Code generation
PPT
ARM Fundamentals
PDF
arm64arm64arm64arm64arm64arm64arm64arm64
PDF
Microcontroller Instruction Set
PDF
reductio [ad absurdum]
PPTX
Computer design
Predication
Coqによる暗号アルゴリズムの実装の安全性検証
optimization c code on blackfin
Microcontroller Instruction Set atmel
At c51ism
Tap lenh ho_8051 (1)
Tap Lenh Ho 8051
C for Microcontrollers
8086 labmanual
8086 labmanual
Bristol 2009 q1_wright_steve
Code generation
ARM Fundamentals
arm64arm64arm64arm64arm64arm64arm64arm64
Microcontroller Instruction Set
reductio [ad absurdum]
Computer design
Ad

More from Silvio Cesare (15)

PDF
A BEGINNER’S JOURNEY INTO THE WORLD OF HARDWARE HACKING
PPTX
Simseer.com - Malware Similarity and Clustering Made Easy
PPTX
Simseer and Bugwise - Web Services for Binary-level Software Similarity and D...
PPTX
FooCodeChu - Services for Software Analysis, Malware Detection, and Vulnerabi...
PPTX
Clonewise - Automatically Detecting Package Clones and Inferring Security Vu...
PPT
Effective flowgraph-based malware variant detection
PPT
Simseer - A Software Similarity Web Service
PPTX
Faster, More Effective Flowgraph-based Malware Classification
PPTX
Automated Detection of Software Bugs and Vulnerabilities in Linux
PPTX
Malware Variant Detection Using Similarity Search over Sets of Control Flow G...
PPT
Simple Bugs and Vulnerabilities in Linux Distributions
PPT
Fast Automated Unpacking and Classification of Malware
PPT
Malware Classification Using Structured Control Flow
PPT
A Fast Flowgraph Based Classification System for Packed and Polymorphic Malwa...
PPT
Security Applications For Emulation
A BEGINNER’S JOURNEY INTO THE WORLD OF HARDWARE HACKING
Simseer.com - Malware Similarity and Clustering Made Easy
Simseer and Bugwise - Web Services for Binary-level Software Similarity and D...
FooCodeChu - Services for Software Analysis, Malware Detection, and Vulnerabi...
Clonewise - Automatically Detecting Package Clones and Inferring Security Vu...
Effective flowgraph-based malware variant detection
Simseer - A Software Similarity Web Service
Faster, More Effective Flowgraph-based Malware Classification
Automated Detection of Software Bugs and Vulnerabilities in Linux
Malware Variant Detection Using Similarity Search over Sets of Control Flow G...
Simple Bugs and Vulnerabilities in Linux Distributions
Fast Automated Unpacking and Classification of Malware
Malware Classification Using Structured Control Flow
A Fast Flowgraph Based Classification System for Packed and Polymorphic Malwa...
Security Applications For Emulation

Recently uploaded (20)

PDF
Power and position in leadershipDOC-20250808-WA0011..pdf
PDF
Roadmap Map-digital Banking feature MB,IB,AB
PDF
DOC-20250806-WA0002._20250806_112011_0000.pdf
PPTX
5 Stages of group development guide.pptx
PPTX
job Avenue by vinith.pptxvnbvnvnvbnvbnbmnbmbh
PPTX
Lecture (1)-Introduction.pptx business communication
PPT
Data mining for business intelligence ch04 sharda
PDF
IFRS Notes in your pocket for study all the time
DOCX
Business Management - unit 1 and 2
DOCX
unit 1 COST ACCOUNTING AND COST SHEET
PPTX
ICG2025_ICG 6th steering committee 30-8-24.pptx
PPTX
CkgxkgxydkydyldylydlydyldlyddolydyoyyU2.pptx
PPTX
svnfcksanfskjcsnvvjknsnvsdscnsncxasxa saccacxsax
PDF
Elevate Cleaning Efficiency Using Tallfly Hair Remover Roller Factory Expertise
PDF
MSPs in 10 Words - Created by US MSP Network
PDF
Outsourced Audit & Assurance in USA Why Globus Finanza is Your Trusted Choice
PPTX
Board-Reporting-Package-by-Umbrex-5-23-23.pptx
PPTX
Probability Distribution, binomial distribution, poisson distribution
PDF
SIMNET Inc – 2023’s Most Trusted IT Services & Solution Provider
PDF
Solara Labs: Empowering Health through Innovative Nutraceutical Solutions
Power and position in leadershipDOC-20250808-WA0011..pdf
Roadmap Map-digital Banking feature MB,IB,AB
DOC-20250806-WA0002._20250806_112011_0000.pdf
5 Stages of group development guide.pptx
job Avenue by vinith.pptxvnbvnvnvbnvbnbmnbmbh
Lecture (1)-Introduction.pptx business communication
Data mining for business intelligence ch04 sharda
IFRS Notes in your pocket for study all the time
Business Management - unit 1 and 2
unit 1 COST ACCOUNTING AND COST SHEET
ICG2025_ICG 6th steering committee 30-8-24.pptx
CkgxkgxydkydyldylydlydyldlyddolydyoyyU2.pptx
svnfcksanfskjcsnvvjknsnvsdscnsncxasxa saccacxsax
Elevate Cleaning Efficiency Using Tallfly Hair Remover Roller Factory Expertise
MSPs in 10 Words - Created by US MSP Network
Outsourced Audit & Assurance in USA Why Globus Finanza is Your Trusted Choice
Board-Reporting-Package-by-Umbrex-5-23-23.pptx
Probability Distribution, binomial distribution, poisson distribution
SIMNET Inc – 2023’s Most Trusted IT Services & Solution Provider
Solara Labs: Empowering Health through Innovative Nutraceutical Solutions

Wire - A Formal Intermediate Language for Binary Analysis

  • 2. • • • • • • • • •
  • 3. – – • – – –
  • 5. i := 0 L1: if i >= 10 goto L2 • t0 := i*I – t1 := &b t2 := t1 + I *t2 := t0 • i := i + 1 – goto L1 L2: – • – – – • – –
  • 6. – – • – – – •
  • 7. • • • – • •
  • 8. Instructions m ::= *(r3) := r1 | r3 := (*r1) | r3 := r1 | r3 := n | r3 := uop r1 | r3 := r1 bop r2 Program p ::= pi|i | r3 := r1 bop n | mkbool r1 ucond Instruction i ::= m| m t | mkbool r1 bcond r2 | nop Type t ::= u8_t | halt | u16_t | label l | u32_t | jmp l | s8_t | ijmp r | s16_t | if r1 cond1 jmp l | s32_t | if r1 cond2 r2 jmp l | lcall s | cast(r1, t) Instructions I ::= ni | r3 := getpc() Heap H ::= nxn  n | r3 := returnaddress() Memory M ::= nn | pusharg(n, r) Register R ::= rn | r3 := malloc(r) Labels L ::= l  pc | free(r) AllocAMemory V ::= nxnn | r3 := alloca(r) Instructions: (maps instruction number to instruction) Operations uop ::= -|~|! Heap: (maps heap address and memory size to non bop ::= +,-,*,/,%,>>,<<,|,&,^ overlapping memory addresses) Conditions ucond ::= == 0|!= 0 Register: (maps register name to numeric value) bcond ::= ==|!= | >|>=|<|<= Memory: (maps address to numeric value) Operands v ::= n (an integer literal) Labels: (maps label to instruction address pc) r (a register) AllocAMemory: (maps alloca address and memory size l (a label) to non overlapping memory addresses) s (a symbol)
  • 9.
  • 10. • • • • • • – – –
  • 11.
  • 14. • • •  add $50,%eax mov $0,%eax sub $50,%eax mov $0,%eax  ASSIGNC $0,-,%eax BOPCADD %eax,$50,%eax BOPCSUB %eax,%50,%eax ASSIGNC $0,,%eax
  • 17. mov $2,%eax mov $1,%ebx mov $1,%ebx mov $2,%eax add %eax,%ebx add %eax,%ebx ASSIGNC $0x2,,%eax ASSIGNC $1,,%ebx BOPADD %ebx,%eax,%ebx ASSIGNC $0x1,-,%ebx ASSIGNC $2,-,%eax BOPADD %ebx,%eax,%ebx
  • 19. xor %eax,%eax xor %eax,%eax jnz $0x80482000 mov $2,%eax mov $2,%eax BOPXOR %eax,%eax,%eax UMKBOOLIsZero %eax,,%zf ASSIGNC $2,-,%eax BOPXOR %eax,%eax,%eax UMKBOOLIsZero %eax,,%zf UCJMPIsNotZero %zf,,$target ASSIGNC $2,-,%eax