User Tools

Site Tools


ex:vcode:start

This is an old revision of the document!


Vulnerable Code

# https://infosecwriteups.com/stack-based-buffer-overflow-practical-for-windows-vulnserver-8d2be7321af5
 
#include<stdio.h>
#include<string.h>
 
int main(void)
{
    char buff[15];
    int pass = 0;
    printf("\n Enter the password : \n");
    gets(buff);
    if(strcmp(buff, "P@ssw0rd")) {
        printf("\n Wrong Password \n");
    }
    else {
        printf("\n Correct Password \n");
        pass = 1;
    }
    if(pass) {
        printf("\n Execute guarded command \n");
        char command[50];
        strcpy(command, "ls -l" );
        system(command);
    }
return 0;
}
ex/vcode/start.1678263993.txt.gz · Last modified: 2023/03/08 09:26 by ebaer

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki