zoukankan      html  css  js  c++  java
  • BUU的三道文件包含题

    BUU LFI COURSE 1

    本地文件包含漏洞

    源码

    <?php
    /**
     * Created by PhpStorm.
     * User: jinzhao
     * Date: 2019/7/9
     * Time: 7:07 AM
     */
    
    highlight_file(__FILE__);
    
    if(isset($_GET['file'])) {
        $str = $_GET['file'];
    
        include $_GET['file'];
    }
    

    LFI漏洞原理

    文件包含漏洞的产生原因是通过引入文件时,由于传入的文件名没有经过合理的校验,或者校验被绕过,从而操作了预想之外的文件,就可能导致意外的文件泄露甚至恶意代码注入。当被包含的文件在服务器本地时,就形成的本地文件包含漏洞

    ?file=/flag

    得到flag

    [BSidesCTF 2020]Had a bad day

    php伪协议读一下,发现后端会给你自动加上php

    得到源码

                  <?php
    				$file = $_GET['category'];
    
    				if(isset($file))
    				{
    					if( strpos( $file, "woofers" ) !==  false || strpos( $file, "meowers" ) !==  false || strpos( $file, "index")){
    						include ($file . '.php');
    					}
    					else{
    						echo "Sorry, we currently only support woofers and meowers.";
    					}
    				}
    				?>
    
    

    看wp知道php://filter可以再套一层协议

    php://filter/read=convert.base64-encode/woofers/resource=flag
    

    base64解码得到flag

    [Windows]LFI2019

    这道题整不明白。一开始没挂vp*的时候三个button都没跳出来。。。挂了之后点进include和upload里put()也没反应。。不知道怎么做了。

    看了wp发现这道题是用不含数字和字母的webshell。

    • 思路一:两个非字母、数字的字符进行异或得到结果

    • 思路二:利用位运算里的取反,利用UTF-8的某个汉字

    • 思路三:借助PHP的一个小技巧,也就是说,'a'++ => 'b''b'++ => 'c'... 所以,我们只要能拿到一个变量,其值为a,通过自增操作即可获得a-z中所有字符。

      那么,如何拿到一个值为字符串'a'的变量呢?

      巧了,数组(Array)的第一个字母就是大写A,而且第4个字母是小写a。也就是说,我们可以同时拿到小写和大写A,等于我们就可以拿到a-z和A-Z的所有字母。

      在PHP中,如果强制连接数组和字符串的话,数组将被转换成字符串,其值为Array

      之后做出来我再补上吧

  • 相关阅读:
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    《EffectiveJava中文第二版》 高清PDF下载
    《MoreEffectiveC++中文版》 pdf 下载
    《啊哈c语言》 高清 PDF 下载
  • 原文地址:https://www.cnblogs.com/LEOGG321/p/13377404.html
Copyright © 2011-2022 走看看