分析一下

__construct:当使用 new 操作符创建一个类的实例时,构造方法将会自动调用

__destuct:在销毁一个类之前执行执行 __wakeup,unserialize()` 会检查是否存在一个`__wakeup()` 方法。如果存在,则会先调用 `__wakeup` 方法,预先准备对象需要的资源。

检查变量var是否存在然后在base64解密 正则过滤了首字母为o或c,冒号,一个或多个数字,冒号,忽略大小写 成功提示stop hacking,失败反序列化var变量 程序结束会销毁新建的Demo对象,触发__destruct()。

这只要对Demo这个类进行序列化,base64加密之后,赋值给var变量进行get传参就行了。

但是

1.反序列化时调用,__wakeup会把$file重置成index.php。

2.序列化开头又字母O,这里被正则过滤了。

想想办法

绕过__wakeup():

绕过__wakeup()是利用CVE-2016-7124漏洞,例如O:4:"Demo":2:{s:10:"\0Demo\0file";s:8:"fl4g.php";}(正常是O:4:"Demo":1:...),反序列化化时不会触发__wakeup()。 (就是只需要令序列化字符串中标识变量数量的值大于实 际变量即可绕过__wakeup()函数)。

绕过正则:

使用+可以绕过preg_match() 正则匹配这里匹配的是 O:4,我们用 O:+4 即可绕过。

构造payload

Web_php_unserialize解题思路的更多相关文章

  1. n皇后2种解题思路与代码-Java与C++实现

    林炳文Evankaka原创作品.转载请注明出处http://blog.csdn.net/evankaka 摘要:本文主要讲了n皇后问题的解题思路,并分别用java和c++实现了过程,最后,对于算法改进 ...

  2. 阿里聚安全攻防挑战赛第三题Android PwnMe解题思路

    阿里聚安全攻防挑战赛第三题Android PwnMe解题思路 大家在聚安全挑战赛正式赛第三题中,遇到android app 远程控制的题目.我们今天带你一探究竟,如何攻破这道题目. 一.题目 购物应用 ...

  3. [LeetCode] 16. 3Sum Closest 解题思路

    Given an array S of n integers, find three integers in S such that the sum is closest to a given num ...

  4. [LeetCode] 234. Palindrome Linked List 解题思路

    Given a singly linked list, determine if it is a palindrome. Follow up:Could you do it in O(n) time ...

  5. [LeetCode] 76. Minimum Window Substring 解题思路

    Given a string S and a string T, find the minimum window in S which will contain all the characters ...

  6. [LeetCode] 3Sum 解题思路

    Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all un ...

  7. [LeetCode] Minimum Size Subarray Sum 解题思路

    Given an array of n positive integers and a positive integer s, find the minimal length of a subarra ...

  8. [LeetCode] Word Break 解题思路

    Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separa ...

  9. [LeetCode] Longest Valid Parentheses 解题思路

    Given a string containing just the characters '(' and ')', find the length of the longest valid (wel ...

随机推荐

  1. 什么?你还不会身份证号码验证?最全的身份证正则验证js

    话不多说上代码 //身份证号合法性验证 //支持15位和18位身份证号 //支持地址编码.出生日期.校验位验证 function cidInfo(code) { var city={11:" ...

  2. 怒肝俩月,新鲜出炉史上最有趣的Java小白手册,第一版,每个 Java 初学者都应该收藏

    这么说吧,在我眼里,Java 就是最流行的编程语言,没有之一(PHP 往一边站).不仅岗位多,容易找到工作,关键是薪资水平也到位,不学 Java 亏得慌,对吧? 那可能零基础学编程的小伙伴就会头疼了, ...

  3. 2019-02-09 python爬取mooc视频项目初级简单版

    今天花了一下午时间来做这东西,之前没有自己写过代码,50几行的代码还是查了很多东西啊,果然学起来和自己动起手来完全是两码事. 方案:requests库+正则表达式提取视频下载链接+urlretriev ...

  4. 【Java入门】JDK安装和环境变量配置(Win7版)

    系统环境:Windows7 x64 安装JDK和JRE版本:1.8.0_191 1.下载JDK安装包 Oracle官网下载网址:https://www.oracle.com/technetwork/j ...

  5. Latex 安装 教程

    需要安装texlive和编辑器texstudio. 安装教程如https://www.cnblogs.com/dingruihfut/p/9690073.html

  6. gdb基本命令总结

    本文介绍使用gdb调试程序的常用命令.  主要内容: [简介] [举例] [其他] [简介]  ============= GDB是GNU开源组织发布的一个强大的UNIX下的程序调试工具.如果你是在 ...

  7. 四分位数与pandas中的quantile函数

    四分位数与pandas中的quantile函数 1.分位数概念 统计学上的有分位数这个概念,一般用p来表示.原则上p是可以取0到1之间的任意值的.但是有一个四分位数是p分位数中较为有名的. 所谓四分位 ...

  8. 初步了解Windows7下部署Sonar

    1.准备工具: (1)Sonar 8.3版本. (2)PostgresSql 11版本. (3)Java 11. 详细获取地址可参考文章https://www.pianshen.com/article ...

  9. 网易java高级开发课程 面对上亿数据量,网易用啥技术?

  10. 9、ssh的集成方式2

    1.在第一种的集成方式中,通过struts2-spring-plugin-2.1.8.1.jar这个插件让spring自动产生对应需要的action类,不需要在对应的spring.xml文件中进行配置 ...