Giter VIP home page Giter VIP logo

Comments (9)

Maijin avatar Maijin commented on July 20, 2024

+1

from r2dec-js.

Maijin avatar Maijin commented on July 20, 2024

why closed? It's not fixed

from r2dec-js.

wargio avatar wargio commented on July 20, 2024

it is on x86

from r2dec-js.

wargio avatar wargio commented on July 20, 2024

https://github.com/wargio/r2dec-js/blob/master/libdec/arch/x86.js#L441

from r2dec-js.

Maijin avatar Maijin commented on July 20, 2024

I tried on master:

aaa ; pdd @ sub.SADFHUHF_10

Lab01-01.zip
(password is "infected")

label_0:
        edi = "hello";
        ecx |= 0xffffffff;
        eax = 0;
        __asm ("repne scasb al, byte es:[edi]");
        ecx = ~ecx;
        ecx--;
        eax = WS2_32_dll_send ();
        if (eax != 0xffffffffffffffff) {
            goto label_3;
        }
        eax = WS2_32_dll_shutdown ();
        if (eax != 0xffffffffffffffff) {
            goto label_3;
        }
...

from r2dec-js.

elicn avatar elicn commented on July 20, 2024

TL;DR: this is an r2 bug, rather than r2dec's

For the first occurrence, a bit-wise operation, I would like to see the actual bit-mask rather than a magic value. As for the two comparisons, r2dec recognizes the magical -1 value according to the underlying architecture, so I looked in the attached binary and noticed that the whole binary is in fact in 32 bits. That made me think -- what an immediate value of 0xffffffffffffffff is doing there in the first place ?

r2 interprets 83 78 ff as cmp eax, 0xffffffffffffffff although the 83 opcode is there to compare registers with an 8-bit immediate value. It is easy to see that this bug came out as a result of sign extension: try to replace the last byte of this sequence with 70h (MSB is clear), and then back to 80h to see the problem.

from r2dec-js.

elicn avatar elicn commented on July 20, 2024

The bottom line is, that r2 should have generated cmp eax, 0xffffffff. In that case, the disassembled output would show -1.

from r2dec-js.

elicn avatar elicn commented on July 20, 2024

I'll open a ticket for r2

from r2dec-js.

radare avatar radare commented on July 20, 2024

from r2dec-js.

Related Issues (20)

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.