background image

$last_line = system('/var/www/html/http/ipt', $retval); 

echo ' 
</pre> 
<hr />Last line of the output: ' . $last_line . ' 
<hr />Return value: ' . $retval; 
?> 
[/CODE] 在浏览器中浏览. 

[color=Red]Chain INPUT (policy ACCEPT) 
target     prot opt source               destination          

Chain FORWARD (policy DROP) 
target     prot opt source               destination          
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED  

Chain OUTPUT (policy ACCEPT) 
target     prot opt source               destination         [/color] 
[color=Blue]my uid :48 
my euid :0 
after setreuid uid :0 
afer sertreuid euid :48[/color] 

-------------------------------------------------------------------------------- 
Last line of the output: afer sertreuid euid :48  
-------------------------------------------------------------------------------- 
Return value: 0  
该命令执行成功

.. 众所周知: apache 的 uid 为 48. 调用 setreuid 后 将有效用户 id 和实际用户

id 互换了.(必须在 chmod u+s 生效的情况下) 使 apache 当前的 uid 为 0 这样就能执行 root 命
令了。