PSF-2017-8

See a problem?
Import Source
https://github.com/psf/advisory-database/blob/main/advisories/python/PSF-2017-8.json
JSON Data
https://api.osv.dev/v1/vulns/PSF-2017-8
Published
2017-06-22T00:00:00Z
Modified
2025-10-09T00:59:49.228511Z
Summary
Environment variables injection in subprocess on Windows
Details

On Windows, prevent passing invalid environment variables and command arguments to subprocess.Popen.

It is possible to inject an environment variable in subprocess on Windows if a user data is passed to a subprocess via environment variable.

Check for invalid environment (variable names containing '=') and command arguments (containing '\0').

Database specific
{
    "cwe_ids": []
}
References

Affected packages

Git / github.com/python/cpython

Affected ranges

Type
GIT
Repo
https://github.com/python/cpython
Events

Affected versions

2.*
2.5
3.*
3.2
v0.*
v0.9.8
v0.9.9
v1.*
v1.0.1
v1.0.2
v1.1
v1.1.1
v1.2
v1.2b1
v1.2b2
v1.2b3
v1.2b4
v1.3
v1.3b1
v1.4
v1.4b1
v1.4b2
v1.4b3
v1.5
v1.5.1
v1.5.2
v1.5.2a1
v1.5.2a2
v1.5.2b1
v1.5.2b2
v1.5.2c1
v1.5a1
v1.5a2
v1.5a3
v1.5a4
v1.5b1
v1.5b2
v1.6a1
v1.6a2
v2.*
v2.0
v2.0b1
v2.0b2
v2.0c1
v2.1
v2.1a1
v2.1a2
v2.1b1
v2.1b2
v2.1c1
v2.1c2
v2.2a3
v2.3c1
v2.3c2
v2.4
v2.4a1
v2.4a2
v2.4a3
v2.4b1
v2.4b2
v2.4c1
v2.5
v2.5.1
v2.5.1c1
v2.5.2
v2.5.2c1
v2.5.3
v2.5.3c1
v2.5.4
v2.5.5
v2.5.5c1
v2.5.5c2
v2.5.6
v2.5.6c1
v2.5a0
v2.5a1
v2.5a2
v2.5b1
v2.5b2
v2.5b3
v2.5c1
v2.5c2
v2.6
v2.6.1
v2.6.2
v2.6.2c1
v2.6.3
v2.6.3rc1
v2.6.4
v2.6.4rc1
v2.6.4rc2
v2.6.5
v2.6.5rc1
v2.6.5rc2
v2.6.6
v2.6.6rc1
v2.6.6rc2
v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c1
v3.4.6
v3.4.6rc1
v3.5.0
v3.5.0a1
v3.5.0a2
v3.5.0a3
v3.5.0a4
v3.5.0b1
v3.5.0b2
v3.5.0b3
v3.5.0b4
v3.5.0rc1
v3.5.0rc2
v3.5.0rc3
v3.5.0rc4
v3.5.1
v3.5.1rc1
v3.5.2
v3.5.2rc1
v3.5.3
v3.5.3rc1
v3.6.0
v3.6.0a1
v3.6.0a2
v3.6.0a3
v3.6.0a4
v3.6.0b1
v3.6.0b2
v3.6.0b3
v3.6.0b4
v3.6.0rc1
v3.6.0rc2

Database specific

vanir_signatures
[
    {
        "target": {
            "file": "Modules/_winapi.c"
        },
        "id": "PSF-2017-8-0333f382",
        "digest": {
            "line_hashes": [
                "218842742840528232984843098097385860803",
                "127454477101569755916249319287056794921",
                "20429125633272882989296568068623439420",
                "175029399360904081049491440687274254856",
                "102429112281530730491428653102180443833",
                "235585304500131722968505286982983450913",
                "162421586083203872780226230748072803087",
                "322346074756910611045843287168821985595",
                "328934268040220999174264523524934004828",
                "122425621509252423320561831842266390004",
                "203520908918794314001852797621283172059",
                "24063307871767707908639706257172603118",
                "256539409247677939625131390922304092346"
            ],
            "threshold": 0.9
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Line",
        "source": "https://github.com/python/cpython/commit/e46f1c19642ea1882f427d8246987ba49351a97d"
    },
    {
        "target": {
            "function": "_PySequence_BytesToCharpArray",
            "file": "Objects/abstract.c"
        },
        "id": "PSF-2017-8-14834195",
        "digest": {
            "function_hash": "30913131539697961270645265071646127013",
            "length": 893.0
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Function",
        "source": "https://github.com/python/cpython/commit/a9b16cff35811f88cdfeb4f50758140dfff36ebc"
    },
    {
        "target": {
            "function": "getenvironment",
            "file": "Modules/_winapi.c"
        },
        "id": "PSF-2017-8-153f2540",
        "digest": {
            "function_hash": "163841087312105237945717372487639270066",
            "length": 1769.0
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Function",
        "source": "https://github.com/python/cpython/commit/d174d24a5d37d1516b885dc7c82f71ecd5930700"
    },
    {
        "target": {
            "function": "getenvironment",
            "file": "Modules/_winapi.c"
        },
        "id": "PSF-2017-8-2a3a3114",
        "digest": {
            "function_hash": "274320457853093996456460671601189504567",
            "length": 1643.0
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Function",
        "source": "https://github.com/python/cpython/commit/e46f1c19642ea1882f427d8246987ba49351a97d"
    },
    {
        "target": {
            "function": "_PySequence_BytesToCharpArray",
            "file": "Objects/abstract.c"
        },
        "id": "PSF-2017-8-2df73dfc",
        "digest": {
            "function_hash": "30913131539697961270645265071646127013",
            "length": 893.0
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Function",
        "source": "https://github.com/python/cpython/commit/d174d24a5d37d1516b885dc7c82f71ecd5930700"
    },
    {
        "target": {
            "function": "getenvironment",
            "file": "Modules/_winapi.c"
        },
        "id": "PSF-2017-8-32b40982",
        "digest": {
            "function_hash": "163841087312105237945717372487639270066",
            "length": 1769.0
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Function",
        "source": "https://github.com/python/cpython/commit/a7c0264735f46afab13771be4218d8eab0d7dc91"
    },
    {
        "target": {
            "function": "posix_execve",
            "file": "Modules/posixmodule.c"
        },
        "id": "PSF-2017-8-3ab40da0",
        "digest": {
            "function_hash": "78152671741007759856191916681405485918",
            "length": 2456.0
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Function",
        "source": "https://github.com/python/cpython/commit/9dda2caca8edc7ff1285f6b0d1c5279b51854b7d"
    },
    {
        "target": {
            "function": "getenvironment",
            "file": "Modules/_winapi.c"
        },
        "id": "PSF-2017-8-66c22e2a",
        "digest": {
            "function_hash": "163841087312105237945717372487639270066",
            "length": 1769.0
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Function",
        "source": "https://github.com/python/cpython/commit/a9b16cff35811f88cdfeb4f50758140dfff36ebc"
    },
    {
        "target": {
            "function": "getenvironment",
            "file": "PC/_subprocess.c"
        },
        "id": "PSF-2017-8-6d2254cb",
        "digest": {
            "function_hash": "98635316900031957423639086866097178428",
            "length": 1338.0
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Function",
        "source": "https://github.com/python/cpython/commit/9dda2caca8edc7ff1285f6b0d1c5279b51854b7d"
    },
    {
        "target": {
            "function": "_PySequence_BytesToCharpArray",
            "file": "Objects/abstract.c"
        },
        "id": "PSF-2017-8-74d52832",
        "digest": {
            "function_hash": "30913131539697961270645265071646127013",
            "length": 893.0
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Function",
        "source": "https://github.com/python/cpython/commit/a7c0264735f46afab13771be4218d8eab0d7dc91"
    },
    {
        "target": {
            "file": "Modules/posixmodule.c"
        },
        "id": "PSF-2017-8-76f6cb58",
        "digest": {
            "line_hashes": [
                "102540342922806165301247411116097768736",
                "327653878775567698959402405123969540370",
                "330034184141175745598210186983612057637",
                "102478924343248121341316006303133974329"
            ],
            "threshold": 0.9
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Line",
        "source": "https://github.com/python/cpython/commit/9dda2caca8edc7ff1285f6b0d1c5279b51854b7d"
    },
    {
        "target": {
            "function": "_winapi_CreateProcess_impl",
            "file": "Modules/_winapi.c"
        },
        "id": "PSF-2017-8-8f61c352",
        "digest": {
            "function_hash": "271443658309875833233823170238814298578",
            "length": 1154.0
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Function",
        "source": "https://github.com/python/cpython/commit/d174d24a5d37d1516b885dc7c82f71ecd5930700"
    },
    {
        "target": {
            "file": "Modules/_winapi.c"
        },
        "id": "PSF-2017-8-93f2b222",
        "digest": {
            "line_hashes": [
                "218842742840528232984843098097385860803",
                "127454477101569755916249319287056794921",
                "20429125633272882989296568068623439420",
                "175029399360904081049491440687274254856",
                "322982551261231145703533718355618806180",
                "5715242493435189744851281508693496242",
                "132421803570913130466468661303708902001",
                "305314381623352237756546632402239381075",
                "102429112281530730491428653102180443833",
                "235585304500131722968505286982983450913",
                "162421586083203872780226230748072803087",
                "322346074756910611045843287168821985595",
                "328934268040220999174264523524934004828",
                "122425621509252423320561831842266390004",
                "203520908918794314001852797621283172059",
                "24063307871767707908639706257172603118",
                "256539409247677939625131390922304092346"
            ],
            "threshold": 0.9
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Line",
        "source": "https://github.com/python/cpython/commit/a7c0264735f46afab13771be4218d8eab0d7dc91"
    },
    {
        "target": {
            "file": "Modules/_winapi.c"
        },
        "id": "PSF-2017-8-b1dc369c",
        "digest": {
            "line_hashes": [
                "218842742840528232984843098097385860803",
                "127454477101569755916249319287056794921",
                "20429125633272882989296568068623439420",
                "175029399360904081049491440687274254856",
                "322982551261231145703533718355618806180",
                "5715242493435189744851281508693496242",
                "132421803570913130466468661303708902001",
                "305314381623352237756546632402239381075",
                "102429112281530730491428653102180443833",
                "235585304500131722968505286982983450913",
                "162421586083203872780226230748072803087",
                "322346074756910611045843287168821985595",
                "328934268040220999174264523524934004828",
                "122425621509252423320561831842266390004",
                "203520908918794314001852797621283172059",
                "24063307871767707908639706257172603118",
                "256539409247677939625131390922304092346"
            ],
            "threshold": 0.9
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Line",
        "source": "https://github.com/python/cpython/commit/a9b16cff35811f88cdfeb4f50758140dfff36ebc"
    },
    {
        "target": {
            "function": "winapi_CreateProcess",
            "file": "Modules/_winapi.c"
        },
        "id": "PSF-2017-8-b408a13f",
        "digest": {
            "function_hash": "178112269804641033195573331268468744796",
            "length": 1286.0
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Function",
        "source": "https://github.com/python/cpython/commit/fe82c46327effc124ff166e1fa1e611579e1176b"
    },
    {
        "target": {
            "function": "getenvironment",
            "file": "Modules/_winapi.c"
        },
        "id": "PSF-2017-8-ba1bfca6",
        "digest": {
            "function_hash": "274320457853093996456460671601189504567",
            "length": 1643.0
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Function",
        "source": "https://github.com/python/cpython/commit/fe82c46327effc124ff166e1fa1e611579e1176b"
    },
    {
        "target": {
            "function": "_winapi_CreateProcess_impl",
            "file": "Modules/_winapi.c"
        },
        "id": "PSF-2017-8-c061b073",
        "digest": {
            "function_hash": "271443658309875833233823170238814298578",
            "length": 1154.0
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Function",
        "source": "https://github.com/python/cpython/commit/a9b16cff35811f88cdfeb4f50758140dfff36ebc"
    },
    {
        "target": {
            "file": "Objects/abstract.c"
        },
        "id": "PSF-2017-8-c2e7e046",
        "digest": {
            "line_hashes": [
                "251540310814918476627921261599236964732",
                "194540472000014089895627714907156536233",
                "123706707309800781550557327471922798113",
                "110400399947081594628525433924345817755",
                "159725014419352665774122105555821831939"
            ],
            "threshold": 0.9
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Line",
        "source": "https://github.com/python/cpython/commit/a7c0264735f46afab13771be4218d8eab0d7dc91"
    },
    {
        "target": {
            "file": "Objects/abstract.c"
        },
        "id": "PSF-2017-8-c4c8f41b",
        "digest": {
            "line_hashes": [
                "251540310814918476627921261599236964732",
                "194540472000014089895627714907156536233",
                "123706707309800781550557327471922798113",
                "110400399947081594628525433924345817755",
                "159725014419352665774122105555821831939"
            ],
            "threshold": 0.9
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Line",
        "source": "https://github.com/python/cpython/commit/e46f1c19642ea1882f427d8246987ba49351a97d"
    },
    {
        "target": {
            "file": "Objects/abstract.c"
        },
        "id": "PSF-2017-8-d1f4fdc0",
        "digest": {
            "line_hashes": [
                "251540310814918476627921261599236964732",
                "194540472000014089895627714907156536233",
                "123706707309800781550557327471922798113",
                "110400399947081594628525433924345817755",
                "159725014419352665774122105555821831939"
            ],
            "threshold": 0.9
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Line",
        "source": "https://github.com/python/cpython/commit/d174d24a5d37d1516b885dc7c82f71ecd5930700"
    },
    {
        "target": {
            "file": "Objects/abstract.c"
        },
        "id": "PSF-2017-8-d7d012ca",
        "digest": {
            "line_hashes": [
                "251540310814918476627921261599236964732",
                "194540472000014089895627714907156536233",
                "123706707309800781550557327471922798113",
                "110400399947081594628525433924345817755",
                "159725014419352665774122105555821831939"
            ],
            "threshold": 0.9
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Line",
        "source": "https://github.com/python/cpython/commit/a9b16cff35811f88cdfeb4f50758140dfff36ebc"
    },
    {
        "target": {
            "function": "_PySequence_BytesToCharpArray",
            "file": "Objects/abstract.c"
        },
        "id": "PSF-2017-8-dfd04745",
        "digest": {
            "function_hash": "75232125542263855095022747957556186587",
            "length": 813.0
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Function",
        "source": "https://github.com/python/cpython/commit/e46f1c19642ea1882f427d8246987ba49351a97d"
    },
    {
        "target": {
            "file": "PC/_subprocess.c"
        },
        "id": "PSF-2017-8-e0b2cea6",
        "digest": {
            "line_hashes": [
                "140509265018338425847735678999426810131",
                "218617570820950613381923668138619619027",
                "137798482213508415901271558218127462061",
                "999930254766206484334640130488721873",
                "160514812869696394708996493059964441464",
                "160121508537454658001275089145564060923",
                "296626333042940398404859631840414931953",
                "340268483148912669996117275173288129394",
                "104440046046311068801388360441218169714",
                "163828546648281964830781286825091071650",
                "89661042890824265561092683734164151093",
                "107220778101649621183847482156425783221"
            ],
            "threshold": 0.9
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Line",
        "source": "https://github.com/python/cpython/commit/9dda2caca8edc7ff1285f6b0d1c5279b51854b7d"
    },
    {
        "target": {
            "file": "Objects/abstract.c"
        },
        "id": "PSF-2017-8-e7a5188b",
        "digest": {
            "line_hashes": [
                "251540310814918476627921261599236964732",
                "194540472000014089895627714907156536233",
                "123706707309800781550557327471922798113",
                "110400399947081594628525433924345817755",
                "159725014419352665774122105555821831939"
            ],
            "threshold": 0.9
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Line",
        "source": "https://github.com/python/cpython/commit/fe82c46327effc124ff166e1fa1e611579e1176b"
    },
    {
        "target": {
            "function": "winapi_CreateProcess",
            "file": "Modules/_winapi.c"
        },
        "id": "PSF-2017-8-eb0ec15d",
        "digest": {
            "function_hash": "178112269804641033195573331268468744796",
            "length": 1286.0
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Function",
        "source": "https://github.com/python/cpython/commit/e46f1c19642ea1882f427d8246987ba49351a97d"
    },
    {
        "target": {
            "function": "_PySequence_BytesToCharpArray",
            "file": "Objects/abstract.c"
        },
        "id": "PSF-2017-8-ef59009d",
        "digest": {
            "function_hash": "30913131539697961270645265071646127013",
            "length": 893.0
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Function",
        "source": "https://github.com/python/cpython/commit/fe82c46327effc124ff166e1fa1e611579e1176b"
    },
    {
        "target": {
            "file": "Modules/_winapi.c"
        },
        "id": "PSF-2017-8-f2d16c59",
        "digest": {
            "line_hashes": [
                "218842742840528232984843098097385860803",
                "127454477101569755916249319287056794921",
                "20429125633272882989296568068623439420",
                "175029399360904081049491440687274254856",
                "102429112281530730491428653102180443833",
                "235585304500131722968505286982983450913",
                "162421586083203872780226230748072803087",
                "322346074756910611045843287168821985595",
                "328934268040220999174264523524934004828",
                "122425621509252423320561831842266390004",
                "203520908918794314001852797621283172059",
                "24063307871767707908639706257172603118",
                "256539409247677939625131390922304092346"
            ],
            "threshold": 0.9
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Line",
        "source": "https://github.com/python/cpython/commit/fe82c46327effc124ff166e1fa1e611579e1176b"
    },
    {
        "target": {
            "function": "_winapi_CreateProcess_impl",
            "file": "Modules/_winapi.c"
        },
        "id": "PSF-2017-8-f7ecbdfe",
        "digest": {
            "function_hash": "271443658309875833233823170238814298578",
            "length": 1154.0
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Function",
        "source": "https://github.com/python/cpython/commit/a7c0264735f46afab13771be4218d8eab0d7dc91"
    },
    {
        "target": {
            "file": "Modules/_winapi.c"
        },
        "id": "PSF-2017-8-fcd9148b",
        "digest": {
            "line_hashes": [
                "218842742840528232984843098097385860803",
                "127454477101569755916249319287056794921",
                "20429125633272882989296568068623439420",
                "175029399360904081049491440687274254856",
                "322982551261231145703533718355618806180",
                "5715242493435189744851281508693496242",
                "132421803570913130466468661303708902001",
                "305314381623352237756546632402239381075",
                "102429112281530730491428653102180443833",
                "235585304500131722968505286982983450913",
                "162421586083203872780226230748072803087",
                "322346074756910611045843287168821985595",
                "328934268040220999174264523524934004828",
                "122425621509252423320561831842266390004",
                "203520908918794314001852797621283172059",
                "24063307871767707908639706257172603118",
                "256539409247677939625131390922304092346"
            ],
            "threshold": 0.9
        },
        "deprecated": false,
        "signature_version": "v1",
        "signature_type": "Line",
        "source": "https://github.com/python/cpython/commit/d174d24a5d37d1516b885dc7c82f71ecd5930700"
    }
]
source
"https://github.com/psf/advisory-database/blob/main/advisories/python/PSF-2017-8.json"