Questions tagged [stack-variables]

Stack variables are variables declared on the stack. They are usually local to the block they were declared in.

Filter by
Sorted by
Tagged with
0 votes
0 answers
41 views

Is there any way to create alias/variable for memory-related value in Radare 2?

I wonder if it is possible in r2 to make alias for the value that repeats itself many times. For instance: I want to have an alias for rbp + rax - 0x1020 to be named as cwd[i]. Can it be done? I ...
satk0's user avatar
  • 101
3 votes
0 answers
607 views

Ghidra view stack frame values

I'm learning reverse engineering, and I'm using Ghidra's debugger to analyze a running program. I want to view the values that are on the stack for a function, but I can't figure out how to do this. I'...
Alex Q's user avatar
  • 131
1 vote
2 answers
305 views

Renaming a local stack variable with IDAPython

I am trying to write an IDAPython script that renames some local variables (in the disassembly window) according to some logic, unfortunately I am unable/failing to use the API to do so... In my ...
rotem.salinas's user avatar
0 votes
1 answer
150 views

troublesome stack frame setup

I have a function with the first few instructions defined as follows: sub rsp, 0x80 lea rbp, [rsp + 0x20] mov qword [rbp + 0x58], rsi mov qword [rbp + 0x50], rbx mov qword [rbp + 0x70], rcx mov ...
Chris H's user avatar
  • 111
3 votes
0 answers
146 views

Calculate stack layout with Ida Python

In Arm in the beginning of function push r4-r6,lr sub sp sp 0x4 In the end of function pop r4-r6,pc add sp sp 0x4 That mean sp is decreased by 4 register*4 bytes+4 bytes for local variables , ...
Kolopoi's user avatar
  • 31
0 votes
1 answer
1k views

Find out the name of constants and var in IDA pro

I'm trying to search with IDA pro constants of type "#define SIZE 100" and normal local variables from a gcc-compiled binary file. I know there are a lot of open threads on the subject but I ...
Michael's user avatar
0 votes
2 answers
755 views

ASM Debuggers that visualize the stack (beginner friendly)

(Cross-posted from Stack Overflow) Are there any debuggers that constantly show a visual of the stack and where everything is within it? For example, taking some random image: I use gdb for most ...
David542's user avatar
  • 103
1 vote
1 answer
60 views

How are members of a Structure Type positioned on the stack?

Some of the structure types have members that are not stacked next to each other. Check out the structure type at 0x33E6 in bzip2_base (x86-64) here. There's an int at location offset 0, a char at 4 ...
Sav's user avatar
  • 15
1 vote
0 answers
218 views

IDA 7.0: Why does editing this function result in red-marked stack-pointer offsets?

I tried to fix the size of both the saved registers and the local variable area using IDA's "Edit function" option as IDA could not recognize it properly by itself. Unedited function: Corrected ...
James's user avatar
  • 11
3 votes
1 answer
5k views

Ghidra interpreting stack pointers wrongly

Why is Ghidra interpreting this incorrectly? The example is very simple. In this stack: 0019FF58 $-8 0019FF58 00000002 LOCAL 2 0019FF5C $-4 0019FF5C 00000001 LOCAL ...
user1156544's user avatar
1 vote
1 answer
2k views

IDA/Hexrays: local variable allocation has failed; how to fix this?

I'm reverse engineering an old DOS game that's using the DOS/4GW extender. The game includes some libraries that I already successfully reversed in a different application, so I'm pretty sure that the ...
Mentulatus's user avatar
2 votes
1 answer
931 views

How to examine/edit stack memory contents using radare2 in debug mode?

How can i examine/edit stack contents using radare2, just like gdb ? Is there a way to examine memory using $rbp or $rsp register like below. x $rbp-10 <--- something like this which can dump from ...
sourav punoriyar's user avatar
1 vote
2 answers
3k views

IDA Hex-Rays: How to SAFELY fix incorrect function declarations?

Update: The problem turned out to be more complex and complex because Hex-Rays incorrectly restores the stack after calls of stdcall functions from cdecl functions: .text:00403F2F 074 ...
Albeoris's user avatar
1 vote
1 answer
316 views

Changing local variable in caller from callee in C? [closed]

I'm implementing a function which is going to perform some time-consuming task, and I'd like to hack the benchmarking part a bit by changing the variable indicating the CPU time my function has ...
nalzok's user avatar
  • 121
2 votes
1 answer
275 views

There is any way to see the subroutine local variables values and who actually access them?

I know that it exists gdb, but i'm talking about windows, i would like know if there is any way to see who access to current stackframe of a specified variable on an X subroutine... i've tried using ...
MindLerp's user avatar
  • 197
0 votes
1 answer
536 views

In IDA 5, is there a way to rename a stack variable mid-function

I am reverse engineering a program using IDA Pro Free 5. In one of the functions, the compiler has reused the stack space of one of the passed in arguments as a local variable of a different type, but ...
Ben Jaguar Marshall's user avatar
0 votes
2 answers
1k views

How does this local var get assigned?

I'm using IDA PRO to disassemble a function, which produces a control flow that looks like this: start_IE proc near Buffer= dword ptr -230h var_22C= byte ptr -22Ch hFile= dword ptr -30h hInternet= ...
the_endian's user avatar
  • 1,830
2 votes
1 answer
649 views

Stack variable information removed in IDA pro (free version)?

I'm using the IDApro free version and I was wondering why sometimes there could be a instruction like... mov [esp + 1140h + var_1234], ebx and if you click inside the bracket, and hit the letter K (...
Arrow's user avatar
  • 123
2 votes
1 answer
183 views

Unknown variable from asm code

During translating some asm code into pseudocode I've found two variables: $rbp-0xb4 and $rbp-0xb8 function check_password(arg0) { var_18 = *0x28; //stack checksum? if (parse_cereal(var_D0, ...
desu's user avatar
  • 238
0 votes
2 answers
3k views

Obtaining memory locations of local variables

For ELF binaries on Linux, if the executable is not stripped, it is possible to recover memory locations of location variables in the form of relative addresses to stack/frame pointer? As an example, ...
sherlock's user avatar
  • 1,371
1 vote
1 answer
378 views

Variable liveness analysis on binaries

I want to detect all the variables live at any instruction/address in a binary. By variable, I refer to both global as well as function local variables. In other words, given a Linux ELF and a virtual ...
sherlock's user avatar
  • 1,371
1 vote
1 answer
793 views

Variable's position on stack

I wanna create a script/program that will modify value in memory of another process. With GDB I've discovered that variable I want modify is located on heap. Because this variable is create ...
bigben's user avatar
  • 11
2 votes
1 answer
221 views

Passing arrays to a function call (Buffer Overflow)

I need to execute a call to cat on a target file using a buffer overflow in a challenge app (can't execute on the stack, but can use libc). For reference, in C this is valid code for what I'm trying ...
Juicy's user avatar
  • 275
2 votes
1 answer
73 views

Trouble understanding change in number when popped from FPU to CPU Stack

So im working on an crackme and came across a couple of FPU loads and pops that confused me. Address main 0040169E pops 80 bit value of 00000000_FED63690h from the FPU stack (ST0=4275451536....
TurtleMan's user avatar
3 votes
1 answer
11k views

64-bit integers on 32-bit machines

Let's say I create a program in C like this and compile it on a regular 64-bit desktop machine: #include <stdint.h> int main(void) { uint64_t a = 0x12345679abcdefULL; uint64_t b = ...
rr-'s user avatar
  • 235
5 votes
1 answer
6k views

How to make stack variables into an array in IDA Pro

I've got a procedure in IDA Pro with a few local stack variables, but part of them belong to an array. I would like to define the array, but pressing * (Create Array) fails, and pressing Y (Set Type) ...
darkf's user avatar
  • 53
1 vote
1 answer
596 views

Stack frame boundary

I've disassembled some C/C++ codes and realized the stack boundary is specified at beginning of a procedure, somehow like this : 1. push ebp 2. mov ebp , esp 3. sub esp , <power> ; <power>...
user3679015's user avatar
3 votes
1 answer
3k views

Check if binary was compiled with security checks (/GS)

I have to check massive amount of binaries whether they were compiled with the /GS option. I assume a good indicator would be to check if they have stack cookie or not. Do you know any tool that can ...
Dominik Antal's user avatar
1 vote
2 answers
504 views

Who does construct the stack on process creation in Windows?

When I start notepad.exe with ollydbg in Windows XP, the initial register was esp:7FFC4 and ebp:7FFF0. stack ... 0007FFC4 7C817067 kernel32.7C817067 <--- ESP 0007FFC8 7C940208 ntdll.7C940208 ...
greenfish's user avatar
1 vote
1 answer
2k views

Memory allocation on the stack

Here is a sample function reverse engineered from an easy program: main proc near var_70 = dword ptr -70h var_6C = dword ptr -6Ch var_68 = dword ptr -68h i_2 ...
upton's user avatar
  • 226
4 votes
1 answer
15k views

IDA PRO repairing stack variables / local variables hex-rays with arrays and proper types / structures any scripts/plugins?

IDA PRO's Hex-Ray gives me these variables. void *v7; // esp@1 const char *v8; // ebx@1 PLAYER *v9; // ebp@1 int v10; // edi@5 PLAYER *v11; // edx@6 int v12; // ecx@9 int v13; // esi@17 ...
SSpoke's user avatar
  • 759