ctfshow————反序列化

本文详细介绍了多个CTF挑战中的PHP反序列化漏洞,从简单的GET参数传递,到改变类属性值,甚至利用 SoapClient 和 Yii2.0 框架进行反序列化攻击。通过实例分析了不同场景下的反序列化漏洞利用方法,包括弱类型、反序列化逃逸和PHP session漏洞等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

web254-普通的get传参

<?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 =  new Ctfshowuser()
        
    if($user->login($username,$password)){
   
        if($user->checkVip()){
   
            $user->vipOneKeyGetFlag();
        }
    }else{
   
        echo "no vip,no flag";
    }
}





username=xxxxxx&password=xxxxxx

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
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值