用的buu
的环境。页面title
是uesless
,直接看附件,搜admin
,在database.ts
文件里发现admin
的创建代码:
1 | INSERT INTO users (id, username, password) VALUES (1, 'admin','e365655e013ce7fdbdbf8f27b418c8fe6dc9354dc4c0328fa02b0ea547659645'); |
用这个登录成功了:
看一下这个框框的逻辑:
1 | router.post('/admin', checkAuth, (req, res, next) => { |
post
的东西先插入html
再变成letter
格式的pdf
,过滤了<,>,/,script,on
,可以xss
注入。
includes()方法绕过
includes() 方法用来判断一个数组是否包含一个指定的值,如果是返回 true,否则false。
这里可以用数组进行绕过。“当其为数组时 include()
会失败”
还有一个路由,要求checksum
是string
,username
不能是上传pdf
时的superuser
。
1 | router.get('/api/files', async (req, res, next) => { |
1 | router.get('/api/files/:id', async (req, res) => { |
http-pdf 任意文件读取漏洞
(CVE-2019-15138)
html-pdf is a Html to pdf converter in nodejs.
Affected versions of this package are vulnerable to Arbitrary File Read. The package fails to sanitize the HTML input, allowing attackers to exfiltrate server files by supplying malicious HTML code. XHR requests in the HTML code are executed by the server. Input with an XHR request such as will result in a PDF document with the contents of .request.open(“GET”,”file:///etc/passwd”)/etc/passwd
在package里可以看到:
"html-pdf": "^2.2.0"
使用了这个库,因此可以用XHR
构造任意文件读取。
XMLHttpRequest接口
https://developer.mozilla.org/zh-CN/docs/Web/API/XMLHttpRequest
1.XMLHttpRequest()
:构造函数。
2.XMLHttpRequest.abort()
:
如果请求已被发出,则立刻中止请求。
3.XMLHttpRequest.open()
:
初始化一个请求。该方法只能在JavaScript
代码中使用。
xhrReq.open(method, url, [async], [user], [password]);
4.XMLHttpRequest.setRequestHeader()
:
设置HTTP请求头部。
myReq.setRequestHeader(header, value);
发送请求。如果请求是异步的(默认),那么该方法将在请求发送后立即返回。
5.XMLHttpRequest.send()
:
XMLHttpRequest.send([body])
body
:
可以为Document
, 在这种情况下,它在发送之前被序列化。
可以为XMLHttpRequestBodyInit
,Blob
, BufferSource (en-US)
, FormData
, URLSearchParams
, 或者 USVString
对象。
默认为null
。
ssrf
读flag
。
payload:
1 | post: |
再访问文件位置下载得到flag
。
好难好难好难乌乌。。
tips
1.数组绕过js
的includes
过滤!
xss绕过:https://blog.csdn.net/weixin_50464560/article/details/119295255
2.ts
开放在8888
端口
参考
1.战队wp
2.https://blog.csdn.net/rfrder/article/details/119914746
3.https://blog.csdn.net/qq_25500649/article/details/119997195
Author: suyumen
Link: https://suyumen.github.io/2021/10/12/2021-10-12-[2021%E7%A5%A5%E4%BA%91%E6%9D%AF]secrets_of_admin/
Copyright: All articles in this blog are licensed under CC BY-NC-SA 3.0 unless stating additionally.