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').
{
"cwe_ids": []
}[
{
"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"
}
]
"https://github.com/psf/advisory-database/blob/main/advisories/python/PSF-2017-8.json"