You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Passing unvalidated user input into the environment variables of a subprocess can allow an attacker to execute malicious code.</p>
7
+
</overview>
8
+
9
+
<recommendation>
10
+
<p>If possible, use hard-coded string literals to specify the environment variable or its value.
11
+
Instead of passing the user input directly to the
12
+
process or library function, examine the user input and then choose
13
+
among hard-coded string literals.</p>
14
+
15
+
<p>If the applicable environment variables cannot be determined at
16
+
compile time, then add code to verify that the user input string is
17
+
safe before using it.</p>
18
+
</recommendation>
19
+
20
+
<example>
21
+
<p>In the following (BAD) example, the environment variable <code>PATH</code> is set to the value of the user input <code>path</code> without validation.</p>
22
+
23
+
<samplesrc="ExecTaintedEnvironmentValue.java" />
24
+
25
+
<p>In the following (BAD) example, an environment variable is set with a name that is derived from the user input <code>var</code> without validation.</p>
26
+
27
+
<samplesrc="ExecTaintedEnvironmentName.java" />
28
+
<p>In the following (GOOD) example, the user's input is validated before being used to set the environment variable.</p>
0 commit comments