安全漏洞|pip-audit:功能强大的安全漏洞扫描工具( 三 )



  --require-hashes      require a hash to check each requirement against for

                        repeatable audits; this option is implied when any

                        package in a requirements file has a `--hash` option.

                        (default: False)

退出代码任务完成后 ,pip-audit将会退出运行 , 并返回一个代码以显示其状态 , 其中:


0:未检测到已知漏洞;
1:检测到了一个或多个已知漏洞;
工具使用样例审计当前Python环境中的依赖:
$ pip-audit

No known vulnerabilities found

审计给定requirements文件的依赖:
$ pip-audit -r ./requirements.txt

No known vulnerabilities found

审计一个requirements文件 , 并排除系统包:
$ pip-audit -r ./requirements.txt -l

No known vulnerabilities found

审计依赖中发现的安全漏洞:
$ pip-audit

Found 2 known vulnerabilities in 1 package

Name  Version ID             Fix Versions

----  ------- -------------- ------------

Flask 0.5     PYSEC-2019-179 1.0

Flask 0.5     PYSEC-2018-66  0.12.3

审计依赖(包含描述):
$ pip-audit --desc

Found 2 known vulnerabilities in 1 package

Name  Version ID             Fix Versions Description

----  ------- -------------- ------------ --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Flask 0.5     PYSEC-2019-179 1.0          The Pallets Project Flask before 1.0 is affected by: unexpected memory usage. The impact is: denial of service. The attack vector is: crafted encoded JSON data. The fixed version is: 1\\. NOTE: this may overlap CVE-2018-1000656.

Flask 0.5     PYSEC-2018-66  0.12.3       The Pallets Project flask version Before 0.12.3 contains a CWE-20: Improper Input Validation vulnerability in flask that can result in Large amount of memory usage possibly leading to denial of service. This attack appear to be exploitable via Attacker provides JSON data in incorrect encoding. This vulnerability appears to have been fixed in 0.12.3\\. NOTE: this may overlap CVE-2019-1010083.

审计JSON格式依赖:
$ pip-audit -f json | jq

Found 2 known vulnerabilities in 1 package

[

  {

    \"name\": \"flask\"

    \"version\": \"0.5\"

    \"vulns\": [

      {

        \"id\": \"PYSEC-2019-179\"

        \"fix_versions\": [

          \"1.0\"

        


        \"description\": \"The Pallets Project Flask before 1.0 is affected by: unexpected memory usage. The impact is: denial of service. The attack vector is: crafted encoded JSON data. The fixed version is: 1\\. NOTE: this may overlap CVE-2018-1000656.\"