text
stringlengths
0
1.99k
memory), at which point emulation ends and all guards are lifted to allow
the debugger to natively step over the emulated code. Native execution then
resumes until the next guarded memory access triggers another symbolic
emulation session.
The memmove example above represents a symbolic emulation session contained
entirely within a single function and basic block, effectively capturing a
concise slice of a selective symbolic emulation session. While the memmove
session is bounded within one function, other symbolic sessions may span
multiple functions. For instance, consider a more complex, cross-function
slice that begins in Mod1.Func_A, continues into Mod2.Func_B, and then
performs nested operations in Mod2.Func_C before returning to Mod2.Func_B:
Triggers
Symbolic MEM load | Mod1.Func_A ldr w8, [x1] <----- Emulation
.-------------------------------------------------------------------------.
| # [LogMemSymbolicDef] MEM Symdef id: f4a70000c1fe |
| ((((SymVar_46) << 8 | SymVar_47) << 8 | SymVar_48) << 8 | SymVar_49) |
'-------------------------------------------------------------------------'
Symbolic w9 | Mod1.Func_A rev w9, w8
Symbolic x0 | Mod1.Func_A mov x0, x9
Symbolic RET x0 | Mod1.Func_A ret
.-------------------------------------------------------------------------.
| # [LogRetSymbolicDef] RET Symdef id: c0ffee0012c4 |
| ((((SymVar_49) << 8 | SymVar_48) << 8 | SymVar_47) << 8 | SymVar_46) |
'-------------------------------------------------------------------------'
Symbolic x22 | Mod2.Func_B mov x22, x0
Not Symbolic | Mod2.Func_B b #0x18c328000
Symbolic Branch | Mod2.Func_B cbz w22, #0x18c328120
Symbolic x0 | Mod2.Func_B add x0, x22, #8
Symbolic Call | Mod2.Func_B bl #0x18c2b000
.-------------------------------------------------------------------------.
| # [LogArgSymbolicDef] ARG Symdef id: 1360c0000ec814 |
| ((((((SymVar_49) << 8 | SymVar_48) << 8 | SymVar_47) << 8 | SymVar_46) |
| + 0x8) & 0xffffffff) |
'-------------------------------------------------------------------------'
Symbolic MEM load | Mod2.Func_C ldp x8, x9, [x0, #0x10]
.-------------------------------------------------------------------------.
| # [LogMemSymbolicDef] MEM Symdef id: ba5eba11dc0c |
'-------------------------------------------------------------------------'
Symbolic x10 | Mod2.Func_C add x10, x9, #3
Symbolic cmp | Mod2.Func_C cmp x10, x8
Symbolic Branch | Mod2.Func_C b.hs #0x18c2b100
Not Symbolic | Mod2.Func_C ldr x8, [x0, #8]
Symbolic MEM load | Mod2.Func_C ldr w8, [x8, x9]
.-------------------------------------------------------------------------.
| # [LogMemSymbolicDef] MEM Symdef id: 3a6e00ddeca8 |
'-------------------------------------------------------------------------'
Not Symbolic | Mod2.Func_C ldrb w10, [x0, #0x44]
Symbolic w11 | Mod2.Func_C rev w11, w8
Not Symbolic | Mod2.Func_C cmp w10, #0
Symbolic w8 | Mod2.Func_C csel w8, w8, w11, ne
Symbolic x9 | Mod2.Func_C add x9, x9, #4
Symbolic MEM Store| Mod2.Func_C str x9, [x0, #0x18]
Symbolic x0 | Mod2.Func_C mov x0, x8
Symbolic RET x0 | Mod2.Func_C ret
.-------------------------------------------------------------------------.
| # [LogRetSymbolicDef] RET Symdef id: 87adf00d13d4 |
'-------------------------------------------------------------------------'
Not Symbolic | Mod2.Func_B ldr x8, [sp, #0x58]
Not Symbolic | Mod2.Func_B sub x23, x8, #8
Symbolic w20 | Mod2.Func_B adds w20, w0, #8
Symbolic Branch | Mod2.Func_B b.hs #0x18c329000
... Emulation continues until no more symbolic registers
In this multi-function session, emulation begins when Mod1.Func_A executes
the guarded load at 'ldr w8, [x1]', producing a symbolic definition
(MEM Symdef id: f4a70000c1fe). Emulation continues through symbolic rev,
mov, and ret instructions in Mod1.Func_A, then picks up in Mod2.Func_B
with the incoming symbolic return value x0: producing a return-boundary
definition (RET Symdef id: c0ffee0012c4). It branches conditionally, calls
into Mod2.Func_C: producing an argument-boundary definition (ARG Symdef
id: 1360c0000ec814) for the call, and then in Mod2.Func_C multiple memory
loads and arithmetic operations extend the slice before returning back to
Mod2.Func_B with a final symbolic return value (RET Symdef id:
87adf00d13d4) for post-call handling.
Throughout this extended session, E0 logs symbolic definitions (Symdefs)
at memory loads, function returns, and argument passages to capture the
precise data-flow def-use chains across-function boundaries. Definitions
are captured exactly at the function-boundary events "ARG, MEM, and RET"
where their symbolic expression holds the full def-use data-flow
information accumulated from all previously emulated and fused symbolic
slices/sessions, tracing back to the root symbolic inputs.
The next Abstract syntax trees (ASTs) samples "collected via Triton - in
AST Python Representation format" treat each SymVar_n as a root symbolic
input corresponding to the n-th byte of a guarded input buffer, where E0
has already marked every byte of that buffer as symbolic. When a load
reads four consecutive bytes from memory, Triton simply retrieves those
preexisting SymVar_ nodes and concatenates them via nested shift/or
operations to form the AST. For instance:
.-------------------------------------------------------------------------.
| > ldr w8, [x1] |
| > loads 4 bytes from memory, resulting in w8 AST: |
| ((((SymVar_46) << 8 | SymVar_47) << 8 | SymVar_48) << 8 | SymVar_49) |
|-------------------------------------------------------------------------|
| > rev w9, w8 |
| > produces w9 AST: |