- 论坛徽章:
- 4
|
本帖最后由 linux_c_py_php 于 2012-09-23 19:19 编辑
1, 转为守护进程.
2, socket连接到远端.
3, system函数执行rm -f 程序名, 删除本程序文件.(此时程序已完全加载入内存,不影响程序运行)
4, 重定向0,1,2到fd, 即标准输入,标准输出,标准错误重定向到了socket(socket双工双向).
5, 在当前进程execl执行/bin/bash -i. 因为:
-i If the -i option is present, the shell is interactive.
所以, /bin/bash -i l将从标准输入读取用户交互的输入, 并向标准输出/错误写出结果. 因为第4步, 所以此时/bin/bash -i将会从socket读取shell命令, 并向socket写出结果.
相当于一个主动连接客户端的telnet服务端, 另一端可以远程操纵本机shell, 比如另一端向本端写如下内容:
remote request:ls\n
local response:
\ aoyun.xml bt em interface.php readme test.php t.py utility xid_for_test_torrent
11.txt a.php curl.php fork.php json.html response.txt test_post.php upload video.html
add_bt.php appsuggection.tar.gz c:\video.html get.php loglog.txt sp.txt tool.php upload_files video.php
add_task.html a.t data.csv index.php log.txt task.php torrent_index_lock upload.html view_bt.php
add_task.php base.php db.php info.php offline_download.sql test.html torrent.php upload.php vim |
|