1,541 questions
2
votes
1
answer
248
views
Forcing a C program to take a forged epilogue made with inline-assembly to jump to arbitrary function
This comes from a post about invoking a trivial buffer overflow (to jump to a function present in the source but not called explicitly in any place of the program (2333909/how-can-i-invoke-buffer-...
4
votes
1
answer
191
views
How can I exploit Buffer Overflow on x86-64 Linux?
I made a simple vulnerable program greet.c:
#include <stdio.h>
#include <string.h>
int main (int argc, char **argv) {
char buf[32];
strcpy(buf, argv[1]);
printf("%s\n"...
0
votes
0
answers
115
views
Reference Error when exploiting buffer overflow
In the code below when I try to overwrite the stack by exploiting the buffer overflow in the line below.
memcpy(&local_1d,*(void **)local_10[1],(ulong)*(uint *)(local_10[1] + 8));
I also ...
1
vote
2
answers
89
views
Is this actually a buffer overflow, or is the author mistaken?
I came across this page here when looking for buffer overflow examples:
https://learn.microsoft.com/en-us/cpp/sanitizers/error-heap-buffer-overflow?view=msvc-170
In this, they mention this code as an ...
0
votes
0
answers
25
views
How to buffer overflow this
\`#include \<iostream\>
#include \<cstring\>
void secretFunction() {
std::cout \<\< " Exploit Successful! You've gained control! " \<\< std::endl;
}
void ...
0
votes
1
answer
205
views
How is a heap overflow attack implemented?
I am learning about heap overflow attacks, but I am encountering a problem.
Based on the knowledge I found online and my own guesses, I believe that a heap overflow attack involves overwriting ...
2
votes
0
answers
102
views
system() returns the error sh: 1: : not found when I try to execute it with "/bin/sh" in the register rdi
I am following a walkthrough of a box on VulnHub, The Planets: Venus.
I got the shell to run through a buffer overflow, by putting an 8 byte padding, a gadget(pop rdi; ret), an address pointing to &...
0
votes
2
answers
67
views
Overflow when encoding a structure into bytes into a buffer
I wrote this function that should write a structure of data into a buffer of bytes then returns how many have been written. The function does the following:
ask as input a buffer of bytes (char *), ...
0
votes
0
answers
145
views
Failed to construct a Palindromic Shellcode
To exploit the buffer overflow vulnerability in a challenge program, I need to craft a payload that satisfies a palindrome check and executes arbitrary code. This requires creating a palindromic ...
2
votes
2
answers
887
views
How do I successfully test this trivial buffer overflow written in C?
I am trying to test this example from StackOverflow (how-can-i-invoke-buffer-overflow), but I am not having success.
I also asked for clarification two weeks ago, directly on the post (through a ...
1
vote
1
answer
679
views
Understanding Stack Frames and Stack Layout in Function Calls on x86 Systems
I'm currently exploring stack frames and how they work in C programs, specifically on unprotected 32-bit x86 systems (no ASLR, stack canaries, or DEP). I'm not primarily a CS Student — I'm a physics ...
2
votes
0
answers
153
views
How do you attack this C doubly linked list through control flow hijacking and buffer overflow?
The attack target
The attack target is a C program which uses a doubly linked list:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct node {
struct node *...
1
vote
0
answers
678
views
How to solve this CTF buffer overflow exploit in C, that takes user input with gets(), but the secret needs to contain a newline?
I am a total beginner in CTF challenges (and not much of an expert in programming in general if I'm being honest) and I've been playing around with gerasdf's InsecureProgramming exercises as a way to ...
-1
votes
3
answers
165
views
Why this c code below works fine? (C Basic, Buffer overflow test) [closed]
#include <stdio.h>
int main(int argc, char *argv[])
{
int arr[5] = {1, 2, 3, 4, 5};
arr[6] = 7; // [1, 2, 3, 4, 5, 6]
printf("arr[6] = %d\n", arr[6]);
return 0;
}...
0
votes
1
answer
78
views
Getting Overflow Error in Excel when using Format() to format as date
I have a vba automation to concatenate some text but it's been giving me the "Overflow" error when changing the result to date in this specific file (works fine in others).
Function ...
3
votes
1
answer
43
views
How does g++ detect format-overflow
With gcc version 13.2.0 (Ubuntu 13.2.0-23ubuntu4)
the following code compiles OK:
char mm[3]; sprintf (mm, "%02d", date_struct->tm_mon); // tm_mon is from 0 to 11
How does gcc know that ...
0
votes
1
answer
63
views
Runtime error: addition of unsigned offset in leetcode
I was solving a question on Leetcode(322. Coin Change) and I wrote my solution which is working on VScode. the code is:
int coinChange(vector<int>& coins, int amount) {
int n = coins.size(...
0
votes
0
answers
50
views
Issue of readdir() reading the pointer to a directory
The basic logic in this problem is that the program scans over a directory for N times, and does some operation on specific file inside.
The bug comes out as: program employs rewinddir() to put the ...
2
votes
1
answer
71
views
Broken pipe passing Python output to C++ input due to size
I'm trying to transform an image into a matrix of it's rbg values in c++, i really like the simplicity of PIL on handling different images extensions, so i currently have two codes
from PIL import ...
1
vote
0
answers
59
views
Buffer overflow with gdb: can't print to the stack to identify buffer start
I'm a student trying to solve an exercise for my cybersecurity course. It's the first time I get in contact with buffer overflows, gdb and so on, so not a lot of experience here. I was given a simple ...
0
votes
1
answer
91
views
Shellcode stub got exited right after executed in Buffer Overflow Exploitation
I am currently playing around with some exploitation techniques in 64-bit Intel executable. My program was compiled with canary protection disabled (-fno-stack-protector), buffer overflow error ...
2
votes
1
answer
827
views
Trying to write a pwntools exploit to buffer-overflow a binary
My goal is to buffer-overflow a binary written in C. That binary asks me to input a name.
After having opened the binary with Ghidra, I discovered the following code that should help me to build an ...
0
votes
1
answer
146
views
Writing a application which uses a Buffer Overflow to execute code from within application which is not called normally
For demonstration / educational purposes I want to write a simple proof of concept application which uses a buffer overflow to execute code from within this app which is not called normally. I thought ...
0
votes
3
answers
361
views
Code vulnerability to buffer overflow attack
#include <stdio.h>
int main(void){
int len;
char input[40]="";
printf("input length : \n");
scanf("%d", &len);
if(len > 40){
return 0;
}
...
-1
votes
1
answer
121
views
Trying to simulate buffer overflow but getting segmentation fault
I am trying to simulate buffer overflow on my mac, but it keeps getting segmentation fault even with -fno-stack-protector.
Below is the output I get.
Vulnerable function executed!
data:...