ApolloAuto / apollo

An open autonomous driving platform
Apache License 2.0
24.71k stars 9.62k forks source link

A kind reminder: shell-command-injection-from-environment in gen.js #15411

Open Vage9 opened 1 month ago

Vage9 commented 1 month ago

System information

Steps to reproduce the issue:

Supporting materials (screenshots, command lines, code/script snippets):

You can get raw data in a repository: https://github.com/Close-Recover/ADS-Code-Test-Results/tree/main I'll take out the related information as follows: In modules/dreamview_plus/frontend/packages/dreamview/scripts/gen.js: path.re ... ../..') 8:23 DREAMVIEW_DIR 8:7 DREAMVIEW_DIR 16:3 `\n${'.. ... PATH}\n` 14:23 generateProto 14:7 generateProto 25:6

and: path.re ... le.js') 10:37 DREAMVIEW_PROTO_BUNDLE_PATH 10:7 DREAMVI ... LE_PATH 21:34 `\n${'.. ... PATH}\n` 20:29 generateDeclaration 20:7 generateDeclaration 39:10 In these two places, building a shell command string with values from the enclosing environment may cause subtle bugs or vulnerabilities. And I think they are related to CWE-078 (https://cwe.mitre.org/data/definitions/78.html, https://www.kiuwan.com/docs/display/K5/CWE-78+%3A+OS+Command+Injection).