general-imports-python-v1
8 rules · Keryn Software Licence · rules 0.8.0 · all packs
How to read a rule
- Severity
- How bad the finding is if it is real:
errorfails a default gate,warningandinfodo not. - Confidence
- P0 exploitable as written; P1 dangerous in context; P2 a heuristic or a posture check: confirm by reading the code.
- False-positive risk
- low: an exact API or flag, so hits are almost always real; medium: the pattern is legitimate in many programs, so check each hit; high: it finds a lead to confirm, so expect benign hits.
- Edge
- The relationship the finding sits on. reaches: content or traffic gets to a thing; calls: one thing invokes another; reads: one thing reads from another; writes: one thing writes to another; sends: data leaves for another party; grants: authority is given or left unchecked; depends_on: something relies on a component it does not verify; trusts: one party believes another without evidence. The boundary it crosses, when there is one: user->prompt (untrusted input reaching a prompt); model->code (model output reaching code, a shell, a query or a page); secret->outside (a secret leaving the trusted side); supply-chain (code, models or prompts pulled in from outside).
- Taxonomy chips
- References for readers who work in OWASP LLM 2025, OWASP Agentic, CWE or NIST AI RMF. They say where a rule belongs, not that a framework is satisfied.
keryn.general.python.import-process-execution
Section titled “keryn.general.python.import-process-execution”info python python
Imports subprocess: this file can start operating-system processes. Inventory only; the command-execution rules report the calls that matter.
Confidence P1: dangerous in context.
Edge inspected: depends_on something relies on a component it does not verify; it crosses the supply-chain boundary (code, models or prompts pulled in from outside).
References: https://docs.python.org/3/library/subprocess.html#security-considerations
keryn.general.python.import-object-deserializer
Section titled “keryn.general.python.import-object-deserializer”info python python
Imports pickle, cPickle, dill or shelve: this file can turn bytes into arbitrary Python objects, which runs code if the bytes are untrusted. Inventory only; the deserialisation rules report the load calls.
Confidence P1: dangerous in context.
Edge inspected: depends_on something relies on a component it does not verify; it crosses the supply-chain boundary (code, models or prompts pulled in from outside).
References: https://docs.python.org/3/library/pickle.html#restricting-globals
keryn.general.python.import-stdlib-xml-parser
Section titled “keryn.general.python.import-stdlib-xml-parser”info python python
Imports a standard-library XML parser (ElementTree, SAX, expatbuilder, minidom, pulldom). Those parsers expand entities without limit; inventory only, the XML rule reports the parse calls.
Confidence P1: dangerous in context.
Edge inspected: depends_on something relies on a component it does not verify; it crosses the supply-chain boundary (code, models or prompts pulled in from outside).
References: https://docs.python.org/3/library/xml.html#xml-vulnerabilities
keryn.general.python.import-cleartext-protocol
Section titled “keryn.general.python.import-cleartext-protocol”info python python
Imports telnetlib or ftplib: this file speaks Telnet or FTP, protocols that send credentials in clear text (ftplib.FTP_TLS excepted). Inventory only; the cleartext-protocol rule reports the client constructors.
Confidence P1: dangerous in context.
Edge inspected: depends_on something relies on a component it does not verify; it crosses the supply-chain boundary (code, models or prompts pulled in from outside).
References: https://peps.python.org/pep-0594/#telnetlib · https://docs.python.org/3/library/ftplib.html
keryn.general.python.xmlrpc-expat
Section titled “keryn.general.python.xmlrpc-expat”warning python python
Imports xmlrpc. Its client and server parse responses and requests with expat, which expands entities without limit, so a hostile peer can exhaust memory or CPU.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: calls one thing invokes another.
Fix: Call defusedxml.xmlrpc.monkey_patch() at start-up, or replace XML-RPC with a JSON API.
References: https://docs.python.org/3/library/xmlrpc.html · https://github.com/tiran/defusedxml#defusedxmlxmlrpc
keryn.general.python.cgi-handler-httpoxy
Section titled “keryn.general.python.cgi-handler-httpoxy”warning python python, twisted
A CGI handler (wsgiref CGIHandler, twisted CGIScript/CGIDirectory) maps the client’s Proxy: header to the HTTP_PROXY environment variable (httpoxy, CVE-2016-5385/5386), so outgoing HTTP from the application can be sent through an attacker’s proxy.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: calls one thing invokes another.
Fix: Serve the application through a WSGI server instead of CGI, or strip the Proxy request header before the handler runs.
References: https://httpoxy.org/ · https://docs.python.org/3/library/wsgiref.html#wsgiref.handlers.CGIHandler
keryn.general.python.pycrypto-namespace
Section titled “keryn.general.python.pycrypto-namespace”info python pycrypto, pycryptodome
Imports from the Crypto package. PyCrypto, the original owner of that name, has been unmaintained since 2013 and has known vulnerabilities (CVE-2013-7459); PyCryptodome installs under the same name. Confirm which package is installed.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk high: it finds a lead to confirm, so expect benign hits.
Edge inspected: depends_on something relies on a component it does not verify.
Fix: Remove pycrypto from the dependencies; use the cryptography package or pycryptodomex (the Cryptodome namespace) so the import cannot resolve to PyCrypto.
References: https://github.com/pycrypto/pycrypto/issues/238 · https://www.pycryptodome.org/src/installation
keryn.general.python.pyghmi-ipmi
Section titled “keryn.general.python.pyghmi-ipmi”info python pyghmi
Imports pyghmi, an IPMI client. IPMI 2.0 authentication (RAKP) gives the password hash to any client that asks, so BMC credentials used here can be cracked offline, and the protocol is often run without encryption.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: sends data leaves for another party; it crosses the secret->outside boundary (a secret leaving the trusted side).
Fix: Keep IPMI on an isolated management network, use a dedicated BMC account per host, and prefer Redfish over HTTPS where the hardware supports it.
References: https://opendev.org/x/pyghmi · https://www.rapid7.com/blog/post/2013/07/02/a-penetration-testers-guide-to-ipmi/