在 execve 的 arg 参数中是否可以进行命令注入
Is a Command injection possible in the arg parameter of execve
我的程序使用 excve 到 运行 a ls,第二个参数由用户填写:
char * envp[1] = { 0 };
execve(my_command, user_input, envp);
用户是否可以在 user_input 参数中插入命令,即使它被视为参数?
我试过 运行ning 这个但是 $( 之前被解释过 :
./my_program.out "$(cat /etc/passwd)"
有没有办法逃避$
但仍然注入命令?
不,除非 ls 中存在漏洞,否则他们无法注入命令。
参见 http://linux.die.net/man/2/execve
The argument vector and environment can be accessed by the called program's main function, when it is defined as: int main(int argc, char *argv[], char *envp[])
我的程序使用 excve 到 运行 a ls,第二个参数由用户填写:
char * envp[1] = { 0 };
execve(my_command, user_input, envp);
用户是否可以在 user_input 参数中插入命令,即使它被视为参数?
我试过 运行ning 这个但是 $( 之前被解释过 :
./my_program.out "$(cat /etc/passwd)"
有没有办法逃避$
但仍然注入命令?
不,除非 ls 中存在漏洞,否则他们无法注入命令。
参见 http://linux.die.net/man/2/execve
The argument vector and environment can be accessed by the called program's main function, when it is defined as:
int main(int argc, char *argv[], char *envp[])