Answer the question
In order to leave comments, you need to log in
How to protect yourself from shell injection?
Hello!
The user enters some keyword, which is then substituted into grep
. What characters should be escaped so that nothing extra can be entered?
Answer the question
In order to leave comments, you need to log in
% echo '$SHELL:' $SHELL; read i; echo '12\ndw\n3e\n/bin/zsh\n> '|grep "${i}"
$SHELL: /bin/zsh
> $SHELL
%
% echo '$SHELL:' $SHELL; read i; echo '12\ndw\n3e\n/bin/zsh\n> '|grep "${i}"
$SHELL: /bin/zsh
> $(cat /etc/passwd)
%
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question