Questions tagged [stack-smash]

Stack smashing is a buffer overflow vulnerability which is characterized by writing data outside the size of a stack-allocated buffer, causing corruption of a neighboring stack frame and potentially permitting execution of malicious code. Use this tag for questions about `stack smashing detected` and similar runtime errors, code with vulnerable buffers and other security risks related to stack smashing. See also: [buffer-overflow] and [buffer-overrun].

In software, a stack buffer overflow (also known as stack smashing) occurs when a program writes to a memory address on the program's call stack outside of the intended data structure, which is usually a fixed length buffer. Stack buffer overflow bugs are caused when a program writes more data to a buffer located on the stack than what is actually allocated for that buffer. This almost always results in corruption of adjacent data on the stack, and in cases where the overflow was triggered by mistake, will often cause the program to crash or operate incorrectly. Stack buffer overflow is a type of the more general programming malfunction known as buffer overflow (or buffer overrun).

This tag should be used for questions about stack smashing detected and similar runtime errors, code with vulnerable buffers and other security risks related to stack smashing. See also: and .

161 questions
0
votes
2 answers

achieve stack smashing with executable file

I try to achieve stack smashing when I have only the executable file . I use the objdump to get the assembly code for this source code : #include #include void func(char *str) { char buffer[24]; int *ret; strcpy(buffer,str);…
Haboosh
  • 29
  • 1
  • 6
0
votes
2 answers

Stack smashing not fires. Why?

I'm trying to make glibc detect stack smashing, and I use the following code: #include #include static const int n = 5; int main(int argc, char *argv[]) { if (argc != 2) { printf("usage: %s string\n", argv[0]); …
Anton K
  • 670
  • 6
  • 19
0
votes
1 answer

Stacksmashing without even accessing any data

On my machine, the following code apparently produces stacksmashing: #include #include void function2(int* data); void function1(); void function2(int* data) { printf("grps "); printf(" "); printf(" one more…
MrBrody
  • 301
  • 2
  • 13
0
votes
0 answers

Why the EIP contents do not execute?

I used buffer overflow and wrote on ret address in stack. When I debug it with gdb, I understood that the eip sets to the address that I want. The address is a gadget in libc. The opcode of the instructions set properly, but it just doesn't execute…
Farzane
  • 173
  • 1
  • 8
0
votes
1 answer

stack smashing detected..while sending ICMP packet

I have written a C program to send an ICMP packet. Here is the corresponding code.. #include #include #include #include #include #include #include #include…
nitish712
  • 19,504
  • 5
  • 26
  • 34
0
votes
2 answers

Is there a bad interaction between gtest and cstdarg, or am I really missing the stack smash here?

My code below is meant to be a simple error logging system that behaves in a way that is similar to printf. All of my code has been running fine in a gtest environment, but now as I exit a deterministic point in the program (one of my tests) it…
Alex Shepard
  • 216
  • 2
  • 10
0
votes
1 answer

Smashed Stack when iterating over int pointers

I'm fairly new to C, and I'm trying to write a utility to open all event handlers which handle EV_KEY events, and give me a list of their file descriptors (while they're still open). The function which does all of that appears to be functioning…
Haz
  • 2,539
  • 1
  • 18
  • 20
0
votes
1 answer

Stack smash test environment

I am trying to test buffer overflow attacks in virtualbox and have been struggling for the past few weeks due to all the security featrues of various distros. I have tried following tutorials online step by step with no luck. Rather than trying to…
NullPointer
  • 545
  • 1
  • 6
  • 17
0
votes
1 answer

C Stack smashing detected after calling a function

Got a problem which to me make no sense. So here goes: I have a function that counts how many times a word appears in a file, thus this function return a integer (int). So on another function it uses the "counter". Now for some reason it decided to…
Alessandroempire
  • 1,640
  • 4
  • 31
  • 54
-1
votes
1 answer

gcc C ***stack smashing detected*** array

The line of code causing the problem is char command_tb_temp[][1000]={"gcc -Wall ","-o3 -ftree-ccp -fno-align-jumps "," Scripts/*.c -o output -lm && time -f \"%e\" -o TB.log ./output 1.dat"}; When the same code is written by giving only 1…
clu3Less
  • 1,812
  • 3
  • 17
  • 20
-1
votes
1 answer

Elusive Stack Smashing error: why does my string_to_float function sometimes crash?

I am working with some legacy C code running on a Raspberry Pi (3, I think) running arch linux. As part of the app's start-up, it reads in a file line by line and stores each line to some custom structure. 99 times out of a hundred, this works fine…
Greenwiz29
  • 37
  • 7
-1
votes
2 answers

reverse engineering (stack-smash) how to find out the address of the stack where the data that I entered into the program is written in the stack

So, my English is very bad, but I will try to explain my problem clearly(sorry about that). I have a program in the С programming language: #include #include void vuln_func(char *data) { char buff[256]; strcpy(buff,…
Snaky
  • 13
  • 3
-1
votes
2 answers

Why mi code compiles ok in SSE2 but not in ARM(no NEON)?

Well, this is the problem: i was trying to compile my altoin in ARM and i get stack smashing error: . Aborted. then, i try to compile exactly the same code but with SSE2 flags in my other linux computer, and it success. if i disable stack protection…
user15069192
-1
votes
1 answer

*** stack smashing detected ***: terminated

I'm trying to print maximum value of array elements. Programm compiles fine, but when I input array values I get this message *** stack smashing detected ***: terminated. What I did wrong? #include int get_max(int ar[5]) { int…
Vardanim
  • 11
  • 1
-1
votes
1 answer

stack smashing detected but the char array is within limits

I am trying to understand what I am doing wrong. The input from keyboard is within the char array limits... even if the input is 8 chars long, it throws an error. it works fine as long as the char is 6 chars long. This is my code (I can swear it…
Alex Susanu
  • 163
  • 1
  • 9
1 2 3
10
11