zoukankan      html  css  js  c++  java
  • CTF SQL注入知识点

    理解常用的登录判断

    select * from user where username='admin' and password='123'
    

    数据库元信息

    infomation_schema

    懂PHP

    php://input

    php://input可以读取没有处理过的POST数据。
    相较于$HTTP_RAW_POST_DATA而言,它给内存带来的压力较小,并且不需要特殊的php.ini设置。
    php://input不能用于enctype=multipart/form-data

    file_get_contents("php://input")获取post数据的二进制流

    with rollup:熟知偏门的SQL知识

    select * from user group by id,name,age with rollup;
    

    跟with rollup类似的还有with cube

    获取当前数据库

    select database()

    获取当前数据库表

    select table_name from information_schema.tables where table_schema='my_database'
    

    SQL流程控制语句

    SELECT      Category =
             CASE type
                WHEN 'popular_comp' THEN 'Popular Computing'
                WHEN 'mod_cook' THEN 'Modern Cooking'
                WHEN 'business' THEN 'Business'
                WHEN 'psychology' THEN 'Psychology'
                WHEN 'trad_cook' THEN 'Traditional Cooking'
                ELSE 'Not yet categorized'
             END,
          CAST(title AS varchar(25)) AS 'Shortened Title',
          price AS Price
    FROM titles
    WHERE price IS NOT NULL
    ORDER BY type, price
    

    MySQL常用函数:不同数据库不一样

    • ascii()
    select ascii('1234');#返回1
    SELECT ascii('1');#返回1
    
    • substring(s from begIndex for length)
      获取子串

    计时攻击:服务器不返回具体信息

    计时攻击巧妙绝伦,虽然有运行SQL语句的权限,但是却没办法获取SQL输出结果。
    这时,可以通过时间来确定SQL输出结果。

    你虽然什么都没说,但我看到你犹豫了。

    case when (ascii(substring((select database()) from %d for 1))
                & %d!=0)
    then sleep(0.5)
    else sleep(0)
    end
    

    对于长度为4的字符串,需要探测4×256次。

    SQL中的空

    select ''=0返回1

  • 相关阅读:
    代办事项
    问题总结2015/05/05
    Android Studio 更新
    Android 防内存泄露handler
    android canvas 绘图笔记
    Android Studio compile error : enum constant INSTANT_RUN_REPLACEMENT does not exist in class
    android Studio 配置LUA 开发环境
    Android 性能优化之(1)-MAT使用教程
    shareSdk打包报错解决办法
    Android 事件分发机制
  • 原文地址:https://www.cnblogs.com/weiyinfu/p/8879523.html
Copyright © 2011-2022 走看看