Tommy 碎碎念

Tommy Wu's blog

在 php 中把 allow_url_fopen 打開的風險
post by tommy @ 16 九月, 2006 21:14

最近老是在我的 /tmp 裡頭, 發現有個多出來的 /tmp/cmdtemp 檔案. 也在 apache 的 error_log 中發現一些訊息如下:

sh: -c: line 1: syntax error near unexpected token `;'
sh: -c: line 1: `; 1> /tmp/cmdtemp 2>&1; cat /tmp/cmdtemp; rm ^M'
rm: cannot remove `\r': No such file or directory
sh: line 1: /tmp/cmdtemp: Permission denied
rm: cannot remove `\r': No such file or directory
sh: line 1: /tmp/cmdtemp: Permission denied
sh: -c: line 1: syntax error near unexpected token `;'
sh: -c: line 1: `; 1> /tmp/cmdtemp 2>&1; cat /tmp/cmdtemp; rm ^M'
cat: write error: Broken pipe
rm: cannot remove `\r': No such file or directory
sh: line 1: /tmp/cmdtemp: Permission denied

雖然我的 /tmp 是獨立的, 且被 mount 為 noexec, 所以上頭的指令都無法正確的執行. 不過... 為什麼會讓人家有辦法把檔案寫入 /tmp/ 內呢?

 (閱讀全文)
Del.icio.us Furl HEMiDEMi Technorati MyShare
Bad Behavior 已經阻擋了 60 個過去 7 天試圖闖關的垃圾迴響與引用。
Power by LifeType. Template design by JamesHuang. Valid XHTML and CSS