buffer-overflow

if one complains about gets(), why not do the same with scanf("%s",...)?

From man gets: Never use gets(). Because it is impossible to tell without knowing the data in advance how many characters gets() will read, and because gets() will continue to store characters past the end of the buffer, it is extremely dangerous to use. It has been used to break computer security. Use fg...

problem with ansi c unexpected behaviour?

I am suffering from an unexpected behavior; here is the problem definition: I have applications communicating on a LAN via UDP protocol. I am reading the IP address and port number from a text file. Initially the IP address and port number are working nicely but, after some time, the IP address that is stored in a char array is corrup...

Codesample with bufferoverflow (gets method). Why does it not behave as expected?

This an extract from a c program that should demonstrate a bufferoverflow. void foo() { char arr[8]; printf(" enter bla bla bla"); gets(arr); printf(" you entered %s\n", arr); } The question was "How many input chars can a user maximal enter without a creating a buffer overflow" My initial answer was 8, because the char-arr...

AudioRecord problems with non-HTC devices

I'm having troubles using AudioRecord. An example using some of the code derived from the splmeter project: private static final int FREQUENCY = 8000; private static final int CHANNEL = AudioFormat.CHANNEL_CONFIGURATION_MONO; private static final int ENCODING = AudioFormat.ENCODING_PCM_16BIT; private int BUFFSIZE = 50; private AudioRec...

performing simple buffer overflow on Mac os 10.6

I'm trying to learn about stack base overflow and write a simple code to exploit stack. But somehow it doesn't work at all but showing only Abort trap on my machine (mac os leopard) I guess Mac os treats overflow differently, it won't allow me to overwrite memory through c code. for example, strcpy(buffer, input) // lets say char buff...

Differences between Assembly Code output of the same program

I have been trying to replicate the buffer overflow example3 from this article aleph one I'm doing this as a practice for a project in a computer security course i'm taking so please, I badly need your help. I've been the following the example, performing the tasks as I go along. My problem is the assembly code dumped by gdb in my compu...

function's return address is different from its supposed value, buffer overflow, HELP PLEASE

Good day everyone! I’m trying to understand how buffer overflow works. I’m doing this for my project in a computer security course I’m taking. Right now, I’m in the process of determining the address of the function’s return address which I’m supposed to change to perform a buffer overflow attack. I’ve written a simple program based from...

Buffer too small when copying a string using wcsncpy_s.

This C++ code is kind of lame, but I need to maintain it. I cannot seem to figure out a "buffer too small" problem. I am using Visual Studio 2010. I will come up with minimal code required to reproduce based on the values I see in the debugger. Sorry, I will not have tested the actual snippet itself. Also, since my system clipboard is "b...

Consequences of this buffer overflow?

So here I believe I have a small buffer overflow problem I found when reviewing someone else's code. It immediately struck me as incorrect, and potentially dangerous, but admittedly I couldn't explain the ACTUAL consequences of this "mistake", if any. I had written up a test app to demonstrate the error, but found (to my dismay) that it...

Do Strong Types prevent Buffer Overflow?

Do strong types, in this case char prevent buffer overflow? char a[100] char b[100] strcpy(a,unknownFunction); // unknownFunction could overflow b // since its length is unknown strcpy(b,a); // can b still overflow a with its now, // potentially overflowed size? ...

What are the prevention techniques for the Buffer overflow attacks ?

what are the ideas of preventing buffer overflow attacks? and i heard about Stackguard,but until now is this problem completely solved by applying stackguard or combination of it with other techniques? after warm up, as an experienced programmer Why do you think that it is so difficult to provide adequate defenses for buffer ov...

Intentional buffer overflow exploit program

Hello all, I'm trying to figure out this problem for one of my comp sci classes, I've utilized every resource and still having issues, if someone could provide some insight, I'd greatly appreciate it. I have this "target" I need to execute a execve(“/bin/sh”) with the buffer overflow exploit. In the overflow of buf[128], when executing...

Linux distribution vulnerable to buffer overflow

i need to demonstrate Buffer overflow in class.Could anyone suggest me distribution and the place where i can download it from. i tried DVL,but it doesnt provide the desired output. ...

Help needed in Demonstartion of BufferOverflow

#include<stdio.h> hijack(){ printf("Hijacked"); } GetInput(){ char buffer[8]; gets(buffer); puts(buffer); } int main(){ GetInput(); //19 return 0; } This is the code... when i place a break point at line 19.. and see the stackpointer i get... 0xbffff7f8: **0xbffff878** 0x0014bbd6 0x00000001 0xbffff8a4 0xbf...

Heap / buffer overflow exception

Just curious, Is there or has anyone ever come across a heap / buffer overflow exception in C#? ...