Questions tagged [c]
General purpose programming language that uses the procedural and structured programming paradigm.
27
questions
47
votes
8
answers
33k
views
How do I add functionality to an existing binary executable?
I want to add some functionality to an existing binary file. The binary file was created using gcc.
Do I need to decompile the binary first, even though I sufficiently understand the functioning of ...
11
votes
2
answers
9k
views
Decompile and recompile C?
What tools produce C code that does not produce errors when you try to recompile it again? Can Hex-Rays decompiler convert everything to project files in a single folder and just compile it?
2
votes
2
answers
2k
views
IDA pro: jump back to previous instruction
I'm new with IDA pro and currently running with debugger, I have few questions:
How can I jump on previous instruction? Undo the latest instruction ?
Is it possible in IDA to examine memory of an ...
45
votes
4
answers
23k
views
convert this x86 ASM to C?
How could this 32-bit x86 assembly be written in C?
loc_536FB0:
mov cl, [eax]
cmp cl, ' '
jb short loc_536FBC
cmp cl, ','
jnz short loc_536FBF
loc_536FBC:
mov byte ptr [eax], ' '
loc_536FBF
mov cl, ...
4
votes
0
answers
2k
views
Reverse Engineering a 8 bit CRC checksum
I am trying to create a communication interface using C Language to an Air conditioning system, after analyzing the data packets I have identified that the data packet is consist of an 8 bit CRC (I am ...
3
votes
1
answer
162k
views
Translate ASSEMBLY to C [closed]
How to translate code assembly to C?? I am very poor in assembly code. EG:
mov dword ptr [ebp+data], 612E2F47h
mov dword ptr [ebp+data+4], 5B2A451Ch
mov dword ptr [ebp+data+8], 6E6B5E18h
...
26
votes
4
answers
16k
views
Can I create an object file using gcc that cannot be reverse engineered?
Is it possible to create an object file using gcc that cannot be reverse engineered to its source code ?
10
votes
2
answers
26k
views
Radare2 C output
I made a simple hello world program, and put it in radare2. I then ran the pc command, which displayed C output. The output was this:
#define _BUFFER_SIZE 256
const uint8_t buffer[256] = {
0x55, ...
9
votes
1
answer
6k
views
BYTE3, does it mean the third or fourth byte of an int? IDB file that's already supplied
I've got a program that i'm trying to debug a little bit by trying to make sense of a function or two, there's already some info that i've downloaded via a idb file and it's helped me get somewhere. ...
8
votes
3
answers
7k
views
buffer overflow exploits - Why is the shellcode put before the return address
The code I'm referring to is found here: Link to code
I read that the buffer overflow exploit uses a buffer that looks something like this:
| NOP SLED | SHELLCODE | REPEATED RETURN ADDRESS |
From ...
8
votes
1
answer
17k
views
Illegal Instruction exploiting sample Buffer Overflow code
Some days ago I coded a simple code to test a buffer overflow exploitation on x86 system. In order to keep it simple I disabled ASLR and NX so there are no protection that could cause weird behaviours....
8
votes
1
answer
3k
views
Chunked function (discontinuous chunks of code comprising a function)
The control flow graph below is from a single function in Notepad (Win7 64-bit). Why is the linker (or the compiler) separating the basic blocks of a single function into multiple, discontinuous ( not ...
5
votes
1
answer
2k
views
In Ollydbg, how do I change the path to a source code file without recreating entire directory structure?
I am bring a .EXE, a .PDB, and a source code .C file into my computer and attempting to look at my program in Ollydbg.
I am compiling C programs on one machine (XP Vm actually) and running them in ...
5
votes
1
answer
3k
views
Writing an exploit for sample-application
I understand the principles of exploiting a classical stack-based buffer-overflow, and now I want to practice it. Therefore I wrote the following test-application:
#include <stdio.h>
#include &...
4
votes
4
answers
1k
views
Why addresses of variable on stack are not consecutive?
The code below is generated by gcc from a simple scanf program.
My question is that
Why these 3 addresses of variables are not consecutive when allocated?
If not, when could I speculate the number ...
4
votes
1
answer
2k
views
IDA Pro C dump for Decryption function
I have been battling this infection I got that encrypts my files in 512 byte chunks with a friend. We have managed to find the Decryption function we think in IDA (the code is heavily obfuscated) from ...
4
votes
1
answer
11k
views
Best way to protect source code of .exe program running on Python?
I am developing proprietary software that would be distributed in a form of .exe file. In order to use it, users will have to authenticate with their whitelist credentials (username + password).
The ...
4
votes
1
answer
1k
views
Insert jmp detour into a compiled program
I've seen references on Stack Exchange and elsewhere to inserting detours into compiled code. My understanding is that essentially a jmp instruction is inserted and then somehow the patched program is ...
3
votes
2
answers
1k
views
How to extract debug information from a DOS executable compiled with Watcom C/C++?
I have a DOS executable which has been compiled with Watcom C/C++ 10.0.
That EXE has debug symbols inside. I was wondering if there is any tool that allow to dump or extract that debug information (...
3
votes
1
answer
11k
views
How does scanf interact with my code in assembly
I have recently started getting into assembly for the purpose of reverse engineering. I started small with understanding basic datatypes, but I want to move on to more complex datatypes and functions. ...
3
votes
1
answer
2k
views
How to intercept a call to function with known name from known DLL
First of all I wasn't very much into reversing until now, so excuse me if my question is dumb.
I have a windows DLL most likely made with Visual C++. It's been developed in 1998 and has Mfc42.dll (4....
3
votes
1
answer
2k
views
ELF binary injection
I am currently working on an ELF-injector and my approach is standard: find code cave (long enough sequence of 0's), rewrite it with the instructions I want to execute and then jump back to the start ...
3
votes
1
answer
1k
views
Good foundation for reverse engineering malware
I have been intrigued by reverse engineering recently and just finished Paul Carter's PC Assembly Language book (http://pacman128.github.io/static/pcasm-book.pdf) which was a great primer for x86. My ...
2
votes
1
answer
1k
views
Capstone: What's the purpose of the 'address' argument in cs_disasm()?
I'm trying to play around with the Capstone Disassembler in C.
In the documentation they show the following use of the cs_disasm() function:
from here
count = cs_disasm(handle, CODE, sizeof(CODE)-1, ...
1
vote
1
answer
89
views
Is there a handy assembly to mock app conversion tool?
It might be too silly of a question, but here you go.
Suppose you have some software that contains a tricky nested assembly sequence (like this one) you try to reverse engineer. brain*[pen&paper] ...
0
votes
1
answer
1k
views
Can we hook the Nt or Zw functions using IAT hooking, or just inline hooking?
So i was trying to hook the ZwQuerySystemInformation or NtZwQuerySystemInformation using IAT, but i found out that these are not inside the IAT inside the memory nor in the PE file
but maybe i am not ...
-1
votes
1
answer
3k
views
How to convert assembly to C code [closed]
Is there an easy to convert assembly (ARM) to C code?