Code Monkey home page Code Monkey logo

whiledetect's Introduction

WhileDetect

--

A python tool for detecting whether there are some while(1) loops in your binary after compiling by GCC

Usage

-- python whiledetect.py [binary_path] eg: python whiledetect.py /opt/nginx/sbin/nginx

Motivation for writing this tool

--

GCC Bug in a hgih version(4.8.*) :the bug of Compile options "-O2"

The code mode(fake c):

for(a=func(b);a!=c;a=func(b)) 
{
    ...task_body...
}

will be optimized to

a=func(b);
if(a!=c)
{
    while(1)
    {
        ...task_body...
    }
}

and the code mode above will run in an endless loop

Problem of false positives of this tool remained

  • The initial function "register_tm_clones" which added by gcc automaticly will be detected as the while true code block, maybe it can be eliminated by set a smaller disntance of JUMP_MAX_DISTANCE in the script named searchwhile.py
  • the code blocks which contain a CALL to EXIT or EXCEPTION syscall will be detected as the while true code block, and this problem remains to be fix by distinguish the target of CALL instructions in the potential code blocks

whiledetect's People

Contributors

whuben avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

s-you uvbs

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.