Git Product home page Git Product logo

jonathansalwan / triton Goto Github PK

View Code? Open in Web Editor NEW
3.3K 132.0 518.0 58.32 MB

Triton is a dynamic binary analysis library. Build your own program analysis tools, automate your reverse engineering, perform software verification or just emulate code.

Home Page: https://triton-library.github.io

License: Apache License 2.0

C 2.72% C++ 75.45% Python 19.58% CMake 0.48% SMT 0.03% Ruby 1.63% Dockerfile 0.05% Shell 0.05% Makefile 0.01%
reverse-engineering symbolic-execution binary-analysis program-analysis taint-analysis binary-translation deobfuscation instruction-semantics lifter dynamic-analysis

triton's People

Contributors

0ca avatar andrix44 avatar antwy avatar apach301 avatar archercreat avatar bananaappletw avatar black-binary avatar brandonros avatar cnheitman avatar ek0 avatar eunchong avatar fmagin avatar fvrmatteo avatar gyorokpeter avatar hexpell avatar igogo-x86 avatar illera88 avatar jonathansalwan avatar jordan9001 avatar k-atc avatar m-carrasco avatar manouchehri avatar mrexodia avatar pbrunet avatar pixelrick avatar romainthomas avatar sweetvishnya avatar theblackunknown avatar toizi avatar xvilka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

triton's Issues

Sort mismatch

movzx eax, byte ptr [rax] #22 = ((_ zero_extend 24) (_ bv97 8))
movsx eax, al             #23 = ((_ sign_extend 24) #22)
sub eax, 0x1              #24 = (bvsub #23 (_ bv1 32))
...
xor eax, 0x55             #31 = (bvxor #24 (_ bv85 32))
mov ecx, eax              #38 = #31
...
movzx eax, byte ptr [rax] #48 = ((_ zero_extend 24) (_ bv49 8))
movsx eax, al             #49 = ((_ sign_extend 24) #48)
cmp ecx, eax              #50 = (bvsub #38 #49)
                          ...
                          #56 = (assert (= #50 (_ bv0 32)))

L'extend sur le 23 n'est pas cencé avoir lieu car il y déjà l'extend au 22. Pareil pour 48 et 49.

Bonne formule :

(set-logic QF_AUFBV)
(declare-fun SymVar_0 () (_ BitVec 8))

(assert (= (bvsub (bvxor (bvsub ((_ sign_extend 24) ((_ zero_extend 0) SymVar_0)) (_ bv1 32)) (_ bv85 32)) ((_ sign_extend 24) ((_ zero_extend 0) (_ bv49 8)))) (_ bv0 32)))

(check-sat)
(get-model)
;(get-value (SymVar_1))

addCallback

With:

  • IDREF.CALLBACK.SYSCALL_ENTRY
  • IDREF.CALLBACK.SYSCALL_EXIT

Taint granularity

Currently, Triton applies an over approximation of the taint. Add sub-registers EAX, AX, AL, AH and spread the taint over these registers

Don't display the PLT trace

0x4005d3        call 0x400450                           n/a
0x400450        jmp qword ptr [rip+0x200bc2]            n/a
0x400456        push 0x0                                #25 = (- #0 (_ bv8 64))
0x400456        push 0x0                                #26 = (_ bv0 64)
0x40045b        jmp 0x400440                            n/a
0x400440        push qword ptr [rip+0x200bc2]           n/a
0x400446        jmp qword ptr [rip+0x200bc4]            n/a
Don't display the trace if the current instruction is outside the .text like this call dans the PLT jump

map symvar -> address

Currently it exist a map address -> symvar but in some case we need the map symvar -> address.

Avoid tight-coupled "Core" classes with Pin API.

The point is to delete the dependence of the "pin.H" header in the "Register.h" header.
The goal is to have a Core totatlly free from any DBI framework's dependences.

One way to achieve this, it's to create maps between the DBI representation of registers and our inner
representation. These maps will be in pinContextHandler and each DBI specific contexthandler must implements
these kind of translation maps.

To reach a clean seperation between the DBI part and the Core part of Triton, I think it would be better
to always use our inner representation in the Core. For example, all IRBuilder classes must use ID_RBP and
not REG_RBP. So, I propose to systematically translate these IDs.
Also, in the pintool we should use the Pin API. This way there will be no doubt about which representation to use.

The direct inconvenient is that we will add some translation costs in function accessing the concrete context from our Core. However, a direct mapping in O(1) is not really a big cost for a cleaner design ;-).

Function derefMem and SIGSEGV

The function derefMem is dangerous.

It try to dereference a pointer without knowing if it's valid or not ?

Example:

pin.sh -t triton.so -startAnalysis check -- samples/crackmes/crackme_sample

The crackme_sample try to read argv[1] even if there is no arguments at all and so it stops
abruptly with a segment fault.

However,right now, the SIGSEV signal comes from the pintool itself and not the program. That's
why our callback that would catch this signal doesn't work.
Sound fair, Pin instruments the program and not the pintool.
Here, the crash comes from the use of the derefMem function with a NULL pointer.

How can we handle this problem ?

This invalid dereferencement must happen, we seek this kind of crash!
The program must be the one doing it. So let's it doing first!

Solution:

- Each instruction where there is a dereferecement MUST be instrumented AFTER the execution
of the instruction!

- derefMem MUST be used only in callback called after the execution of the instruction!

export smt2lib into python bindings

Example:

zfId = getRegSymbolicID(IDREF.FLAG.ZF)
expr = getBacktrackedSymExpr(zfId)
getModel(smt2lib.assert(smt2lib.equal(expr, smt2lib.bv(1, 1))))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.