zoukankan      html  css  js  c++  java
  • 实验吧_NSCTF web200&FALSE(代码审计)

    挺简单的一个代码审计,这里只要倒序解密就行了,这里给一下python版的wp

     1 import codecs
     2 import base64
     3 
     4 strs = 'a1zLbgQsCESEIqRLwuQAyMwLyq2L5VwBxqGA3RQAyumZ0tmMvSGM2ZwB4tws'
     5 str1 = codecs.encode(strs, 'rot13')
     6 str2 = str1[::-1]
     7 str3 = base64.b64decode(str2)
     8 str4 = codecs.decode(str3,'utf-8')
     9 key = ''
    10 i = 0
    11 while i < len(str4):
    12     asc = ord(str(str4[i]))
    13     
    14     s = chr(asc-1)
    15     key += s
    16     i += 1
    17 key = key[::-1]
    18 print(key)
    19     

    False

    又是一道代码审计的题:

     1 <?php
     2 if (isset($_GET['name']) and isset($_GET['password'])) {
     3     if ($_GET['name'] == $_GET['password'])
     4         echo '<p>Your password can not be your name!</p>';
     5     else if (sha1($_GET['name']) === sha1($_GET['password']))
     6       die('Flag: '.$flag);
     7     else
     8         echo '<p>Invalid password.</p>';
     9 }
    10 else{
    11     echo '<p>Login first!</p>';
    12 ?>

    我也是看了大佬的wp才知道,这里就直接引用大佬的分析了,大佬写的很详细

    “分析代码逻辑,发现GET了两个字段name和password,获得flag要求的条件是:name != password & sha1(name) == sha1(password),乍看起来这是不可能的,其实可以利用sha1()函数的漏洞来绕过。如果把这两个字段构造为数组,如:?name[]=a&password[]=b,这样在第一处判断时两数组确实是不同的,但在第二处判断时由于sha1()函数无法处理数组类型,将报错并返回false,if 条件成立,获得flag。

    经验证md5()函数同样存在此漏洞。”

  • 相关阅读:
    关于MATLAB处理大数据坐标文件2017527
    关于MATLAB处理大数据坐标文件2017526
    关于MATLAB处理大数据坐标文件
    Python入门(2)
    Python入门
    [leetcode] 349. Intersection of Two Arrays 解题报告
    [leetcode] 283. Move Zeroes 解题报告
    [leetcode] 389. Find the Difference 解题报告
    [leetcode] 104. Maximum Depth of Binary Tree
    [leetcode] 258. Add Digits
  • 原文地址:https://www.cnblogs.com/Ragd0ll/p/8642297.html
Copyright © 2011-2022 走看看