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()函数同样存在此漏洞。”

  • 相关阅读:
    Hadoop Gateway 部署
    java 命令--备忘
    整理下常用硬件性能参数
    python 脚本备份 mysql 数据库到 OSS
    pip 更换国内源
    记录闭包和立即执行函数
    Django 中文乱码问题&富文本显示
    mysql exceeded the 'max_questions' resource 记录
    sql server 数据字典的妙用
    Sublime Text指南
  • 原文地址:https://www.cnblogs.com/Ragd0ll/p/8642297.html
Copyright © 2011-2022 走看看