Why it matters
A machine in the network path can impersonate the server and read the session.
How to fix it
Load known host keys (load_system_host_keys) and keep the default RejectPolicy.
Example
The rule's own test fixtures, verbatim: the test suite requires the rule to report the first and not the second.
import paramiko
def connect(host):
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(host)
return clientimport paramiko
def connect(host):
client = paramiko.SSHClient()
client.load_system_host_keys()
client.connect(host)
return clientWhat TrustIvan reads
Runs on repository scans of Python source once static analysis is turned on (SAST_RULES and the separately built analyzer image); it is off by default.
Weakness classes and references
Related checks
- Weak cipher (Python)
PythonSeverity: High
trustivan-python-weak-cipher - Bind all interfaces debug server (Python)
PythonSeverity: Medium
trustivan-python-bind-all-interfaces-debug-server - Django CSRF exempt (Python)
PythonSeverity: Medium
trustivan-python-django-csrf-exempt - Eval non literal (Python)
PythonSeverity: Medium
trustivan-python-eval-non-literal - Tarfile extractall (Python)
PythonSeverity: Medium
trustivan-python-tarfile-extractall - LDAP injection from request input (Python)
PythonSeverity: High
trustivan-python-taint-ldap-injection
Terms: SAST (static application security testing), Taint analysis, CWE (Common Weakness Enumeration), OWASP Top 10
All static analysis (SAST) checks · The whole catalogue · How this works in TrustIvan · Documentation