Using Components with Known Vulnerabilities
What does Using Components with Know Vulnerability means?
When a developer uses a piece of code or library which already has a known vulnerability, then this may result in compromise of the entire application. This occurs when the components such as libraries and frameworks used within the app mostly execute with full privileges. If a vulnerable component is exploited, it makes the hacker’s job easier to cause a serious data loss or server takeover.
This lab helps us to understand why components with known vulnerabilities can be a serious issue.
The user on accessing the lab is provided with a feature to convert yaml files into json objects.
A yaml file needs to be chosen and uploaded to get the json data.
There is also a get version feature which tells the user the version of the library the app uses.
Exploiting the vulnerability.
- The app uses
pyyaml 5.1Which is vulnerable to code execution. - You can google the library with the version to get the poc and vulnerability details
- Libraries known for the infamous code injection vulnerabilities are PyYAML 5.4 and Log4J
- Create An yaml file with this payload:
- On Uploading this file the user should be able to see the output of the command executed in the Terminal running Django.
!!python/object/apply:subprocess.Popen
- ls
This lab helps us to understand why components with known vulnerabilities can be a serious issue.
This is website for some image manupulation.
Exploiting the vulnerability.
- The app uses
Pillow 8.0.0Which is vulnerable to code execution. - You can google the library with the version to get the poc and vulnerability details
Mitigation
- Remove unused dependencies, unnecessary features, components, files, and documentation.
- Only obtain components from official sources over secure links. Prefer signed packages to reduce the chance of including a modified, malicious component.
- Monitor for libraries and components that are unmaintained or do not create security patches for older versions. If patching is not possible, consider deploying a virtual patch to monitor, detect, or protect against the discovered issue.
- Use Library scanners to test for Vulnerabilities in packages.