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
3
votes
4 answers

Why am I not getting stack smashing error when I access memory beyond what I allocated?

I should get stack smashing error here . What is the reason I am not getting it? #include #include #include struct mun { int len; char str[0]; }; int main(void) { //char mp[8]; struct mun…
munjal007
  • 245
  • 1
  • 2
  • 6
3
votes
1 answer

Instructions in C buffer being executed only as sudo

I'm working on a buffer overflow attack as described in Aleph One's article Smashing the Stack for Fun and Profit. As proposed in the article, I've written a program (shellcode.c) that plants the malicious code (shellcode) into an environment…
addy689
  • 176
  • 1
  • 8
2
votes
2 answers

Why does referencing this char array cause Stack smashing, using C?

The program takes a pointer to a char array and an int. The char array consists of two numbers, separated by a space. The use of the function is to read the values of the char array as integers and replace them with the multiplied value of the…
HeapUnderStop
  • 378
  • 1
  • 9
2
votes
1 answer

why stack overflow attacks (modifying the returning address of a function call) caused segmentation fault in `_int_malloc`

I'm learning the structure of stack frames. And trying to implement a function that can call another function without an explicit call in C by modifying the returning address (in its stack frame) of the function call. The code is like the…
ttzytt
  • 57
  • 4
2
votes
1 answer

ARM PC overwritten with incorrect value in buffer overflow

I am working on stack smashing on ARM and I have a buffer declared as: char buff[12]; in my code. In order to find the location where the PC gets overwritten in gdb I write AAAABBBBCCCCDDDDEEEEFFFF to buff I expected DDDD to overwrite FP(r11) as…
dbayoxy
  • 33
  • 7
2
votes
1 answer

'undefined symbol: __stack_chk_guard' in libopenh264.so when building FFmpeg with emcc

I am trying to build codecbox.js on Ubuntu 18.04, which involves building FFmpeg with emcc. At some stage of the build process, FFmpeg's configure script tries to process the following code: #include #include long…
2
votes
1 answer

pragma pack(push) without corresponding pop leads to stack smashing

I used #pragma pack(push, 2) at the beginning of a struct in a header file but forgot the corresponding #pragma pack(pop). After including this header file, I included fstream. On creating an ofstream object, I am seeing stack smashing. Details of…
vkj
  • 43
  • 3
2
votes
0 answers

Stack smashing when declaring new member attribute

When I am declaring a new member attribute in my game.cpp class like this: int test; I have a stack smashing error which is really strange because without the new attribute my program is running fine. I know my problem is probably somewhere…
Jules
  • 185
  • 1
  • 16
2
votes
0 answers

stack smashing when using Poco::JSON::Object in dynamic library

I'm trying to build a dynamic library in which I used Poco::JSON library. // header file #ifndef __MATH_H__ #define __MATH_H__ #include class math { public: static math* getInstance() { if (NULL == m_pMath) { …
Toe
  • 21
  • 2
2
votes
1 answer

Weird stack smash error - caused by unused, uninitialized member variable

Today I had a fun bug where apparently my stack got smashed, overriding the G++ return-point canary (I think that's the protection used). My offending class was this: class ClientSendContext : public SendContext { public: …
Max
  • 4,345
  • 8
  • 38
  • 64
2
votes
1 answer

Nanopore tools designed to analyze fastq file format?

I just received my first nanopore data set and was sent a fastq file. I was expecting a fast5 file, and now I'm not sure how to begin filtering the data. Most of the tools I've come across (NanoOK, poretools) deal with the fast5 format, although…
7tbear7
  • 21
  • 3
2
votes
0 answers

If the python executable is specified via `env`, ptrace smashes stack

I'm trying to intercept the getrandom syscall and modify its results. I tried to make a minimal reproducible example, here it is: [the original codebase was written in Rust, had about 400 lines, proper error checking and suffered from the same…
marmistrz
  • 5,974
  • 10
  • 42
  • 94
2
votes
0 answers

What's the point of Position-independent executables (PIE) when we have execstack?

I'm reading Hacking: The art of exploitation, which is apparently full of outdated information (doesn't take into account canaries, non executable stack, ASLR). I am trying to understand whether (and how) stack overflow attacks are possible even on…
Ste_95
  • 361
  • 3
  • 15
2
votes
1 answer

Stack smashing on OS X Yosemite?

I'm having trouble figuring out how to disable stack protection on OS X 10.10.5 (Yosemite). I've sort of been cobbling together promising gcc flags from various threads online, but as of yet haven't managed to disable the protection. I am…
Kvass
  • 8,294
  • 12
  • 65
  • 108
2
votes
2 answers

*** stack smashing detected ***: a.out terminated

So I'm working on a program in my Programming I class and we were assigned to create a program that will check to see if a routing number from a bank is valid. Every time I run this program on NetBeans, I have no issue. BUT, when I run it through…
Alex Pak
  • 21
  • 1
  • 2
1
2
3
10 11