Black List Calls

Blacklists (Calls)

Overview

The "Blacklists (Calls)" feature in BugZ is designed to identify and flag potentially dangerous function calls within your source code. These calls are known to introduce security risks or are considered unsafe practices. This page details the types of function calls that BugZ scans for, why they are considered risky, and how you can address these issues.

Function Calls Considered Harmful

The following tables provide an overview of various security vulnerabilities identified by their unique IDs, names, the specific calls that are considered risky, and their severity levels. This information is crucial for developers looking to mitigate potential security risks in their applications.

High Severity Vulnerabilities

IDNameCallsSeverity
1004ciphersCrypto.Cipher.ARC2.new, Crypto.Cipher.ARC4.new, Crypto.Cipher.Blowfish.new, Crypto.Cipher.DES.new, Crypto.Cipher.XOR.new, Cryptodome.Cipher.ARC2.new, Cryptodome.Cipher.ARC4.new, Cryptodome.Cipher.Blowfish.new, Cryptodome.Cipher.DES.new, Cryptodome.Cipher.XOR.new, cryptography.hazmat.primitives.ciphers.algorithms.ARC4, cryptography.hazmat.primitives.ciphers.algorithms.Blowfish, cryptography.hazmat.primitives.ciphers.algorithms.IDEAHigh
1012telnetlibtelnetlib.*High
1021ftplibftplib.*High
1022inputinputHigh

Medium Severity Vulnerabilities

IDNameCallsSeverity
1001picklepickle.loads, pickle.load, pickle.Unpickler, dill.loads, dill.load, dill.Unpickler, shelve.open, shelve.DbfilenameShelf, jsonpickle.decode, jsonpickle.unpickler.decode, jsonpickle.unpickler.Unpickler, pandas.read_pickleMedium
1002marshalmarshal.load, marshal.loadsMedium
1003md5hashlib.md5, hashlib.sha1, Crypto.Hash.MD2.new, Crypto.Hash.MD4.new, Crypto.Hash.MD5.new, Crypto.Hash.SHA.new, Cryptodome.Hash.MD2.new, Cryptodome.Hash.MD4.new, Cryptodome.Hash.MD5.new, Cryptodome.Hash.SHA.new, cryptography.hazmat.primitives.hashes.MD5, cryptography.hazmat.primitives.hashes.SHA1Medium
1005cipher_modescryptography.hazmat.primitives.ciphers.modes.ECBMedium
1006mktemp_qtempfile.mktempMedium
1007evalevalMedium
1008mark_safedjango.utils.safestring.mark_safeMedium
1009httpsconnectionhttplib.HTTPSConnection, http.client.HTTPSConnection, six.moves.http_client.HTTPSConnectionMedium
1010urllib_urlopenurllib.urlopen, urllib.request.urlopen, urllib.urlretrieve, urllib.request.urlretrieve, urllib.URLopener, urllib.request.URLopener, urllib.FancyURLopener, urllib.request.FancyURLopener, urllib2.urlopen, urllib2.Request, six.moves.urllib.request.urlopen, six.moves.urllib.request.urlretrieve, six.moves.urllib.request.URLopener, six.moves.urllib.request.FancyURLopenerMedium
1013xml_bad_cElementTreexml.etree.cElementTree.parse, xml.etree.cElementTree.iterparse, xml.etree.cElementTree.fromstring, xml.etree.cElementTree.XMLParserMedium
1014xml_bad_ElementTreexml.etree.ElementTree.parse, xml.etree.ElementTree.iterparse, xml.etree.ElementTree.fromstring, xml.etree.ElementTree.XMLParserMedium
1015xml_bad_expatreaderxml.sax.expatreader.create_parserMedium
1016xml_bad_expatbuilderxml.dom.expatbuilder.parse, xml.dom.expatbuilder.parseStringMedium
1017xml_bad_saxxml.sax.parse, xml.sax.parseString, xml.sax.make_parserMedium
1018xml_bad_minidomxml.dom.minidom.parse, xml.dom.minidom.parseStringMedium
1019xml_bad_pulldomxml.dom.pulldom.parse, xml.dom.pulldom.parseStringMedium
1020xml_bad_etreelxml.etree.parse, lxml.etree.fromstring, lxml.etree.RestrictedElement, lxml.etree.GlobalParserTLS, lxml.etree.getDefaultParser, lxml.etree.check_docinfoMedium
1023unverified_contextssl._create_unverified_contextMedium
1025tempnamos.tempnam(), os.tmpnam()Medium

Low Severity Vulnerabilities

IDNameCallsSeverity
1011randomrandom.Random, random.random, random.randrange, random.randint, random.choice, random.choices, random.uniform, random.triangular, random.randbytesLow

This table is a part of BugZ's effort to provide comprehensive security insights into commonly used but potentially risky function calls in Python, enabling developers to enhance their code security effectively.

Best Practices

  • Regular Code Reviews: Incorporate regular code reviews focusing on security to catch uses of blacklisted function calls.
  • Static Analysis: Use static analysis tools like BugZ routinely to automatically detect and report the use of high-risk function calls.
  • Developer Education: Educate developers about the risks associated with these function calls and train them on safer alternatives.

By adhering to these guidelines and using BugZ, you can significantly enhance the security posture of your applications, mitigating the risk of exploiting dangerous function calls.