Skip to content

Ida symbol exec#52

Merged
serpilliere merged 7 commits intocea-sec:masterfrom
commial:ida-symbol_exec
Feb 10, 2015
Merged

Ida symbol exec#52
serpilliere merged 7 commits intocea-sec:masterfrom
commial:ida-symbol_exec

Conversation

@commial
Copy link
Copy Markdown
Contributor

@commial commial commented Feb 9, 2015

This PR add a plug-in example for IDA, based on Miasm symbolic execution engine. It also features the VarExpander possibility.

For instance, on samples/sc_connect_back.bin, one selects the targeted area.
select

Then, by calling symbolic_exec() or pressing F3, the new view Symbolic Execution ... is created.
symbolexec

If a line is too complicated, one can expand it by pressing E or Right click > Expand.
varexpanded

The common code between IDA examples has been moved to samples/ida/utils.py.

@p-l-
Copy link
Copy Markdown
Contributor

p-l- commented Feb 9, 2015

Really nice work!

@aguinet
Copy link
Copy Markdown
Contributor

aguinet commented Feb 9, 2015

yep nice one :) !

@commial
Copy link
Copy Markdown
Contributor Author

commial commented Feb 9, 2015

Thanks you !
Actually, it's just a basic binding with already available features.

I've add the possibility to get back an equivalent Miasm2 expression in its Python form.

For instance, by pressing P or Right click > Get in Python on nf:
translateform

That is to say:

>>> expr = ExprAff(ExprId('nf', size=1), ExprSlice(ExprOp('+', ExprId('EDX_init', size=32), ExprMem(ExprOp('+', ExprMem(ExprId('ESP_init', size=32), size=32), ExprInt_fromsize(32, 0x24)), size=32)), 31, 32))
>>> print expr
nf = (EDX_init+@32[(@32[ESP_init]+0x24)])[31:32]

@commial
Copy link
Copy Markdown
Contributor Author

commial commented Feb 9, 2015

There is no reason to limit the translation to Miasmtranslator.

Add a ComboBox to choose the translator (T or Right click > Translator).
multi

@commial
Copy link
Copy Markdown
Contributor Author

commial commented Feb 10, 2015

An infinite loop was reached in a corner case of Variable Identifier (reported by @serpilliere).

One of the commit also add the prefix feature, which result in:

of_v0 = @32[@32[ESP_init] + 0x24]
of_v1 = EDX_init
of = ((of_v1 ^ of_v0 ^ 0xFFFFFFFF) & (of_v0 ^ (of_v1 + of_v0)))[31:32]
cf_v0 = EDX_init
cf_v1 = @32[@32[ESP_init] + 0x24]
cf_v2 = cf_v0 + cf_v1
cf = (cf_v0 ^ cf_v1 ^ ((cf_v0 ^ cf_v1 ^ 0xFFFFFFFF) & (cf_v1 ^ cf_v2)) ^ cf_v2)[31:32]

That way, the IDA highlighting of variables can be used in a clever way.

@serpilliere
Copy link
Copy Markdown
Contributor

The module needs to be imported twice due to a strange bug between IDA and Miasm.

serpilliere added a commit that referenced this pull request Feb 10, 2015
@serpilliere serpilliere merged commit 3884615 into cea-sec:master Feb 10, 2015
@commial commial deleted the ida-symbol_exec branch February 10, 2015 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants