当前位置:网站首页>反序列化——php反序列化
反序列化——php反序列化
2022-06-23 21:48:00 【游戏编程】
PHP序列化
- 序列化 serialize(),是指将一个实例化的变量、数组、对象等结构从一个实例转换为一个简短的序列化字符串,这样便于保存对象,可以将序列化字节存储到数据库或者文本当中。
反序列化 unserialize(),当需要调用一个序列化的对象的时候,可以通过反序列化方法直接调用 序列化字符串解析获取保存的对象,而不需要重新实例化一个类。 魔术方法 :当PHP在进行序列化、反序列化、访问对象操作的时候,会自动调用一些方法,这些被自动调用的方法,被称为魔术方法,通常以__作为方法名前缀。
**__construct()** 对象创建(new)时会自动调用。
**__wakeup()** 使用unserialize时触发
__sleep() 使用serialize时触发
**__destruct()** 对象被销毁时触发
__call() 在对象上下文中调用不可访问的方法时触发
__callStatic() 在静态上下文中调用不可访问的方法时触发
__get() 用于从不可访问的属性读取数据
__set() 用于将数据写入不可访问的属性
__isset() 在不可访问的属性上调用isset()或empty()触发
__unset() 在不可访问的属性上使用unset()时触发
__toString() 把类当作字符串使用时触发
__invoke() 当脚本尝试将对象调用为函数时触发
__autoload() 在代码中当调用不存在的类时会自动调用该方法。
PHP反序列化漏洞利用
- 漏洞产生的原因:在反序列化过程中,可以任意修改类的属性值,所以如果未对输入的序列化字符串进行检测,就会导致攻击者可以控制反序列化过程,构造属性自定义的序列化对象,如果这些对象被魔术方法调用,就可能导致代码执行,SQL注入,目录遍历等不可控后果。
作者:努力学习的胡豆
游戏编程,一个游戏开发收藏夹~
如果图片长时间未显示,请使用Chrome内核浏览器。
边栏推荐
- How to set the protective strip in the barcode
- 蚂蚁获FinQA竞赛冠军,在长文本数值推理AI技术上取得突破
- Detailed explanation of bitmap optimization
- The time deviation is more than 15 hours (54000 seconds), and the time cannot be automatically calibrated
- [tcapulusdb knowledge base] [generic table] read data interface description
- WordPress plugin wpschoolpress 2.1.16 -'multiple'cross site scripting (XSS)
- 运维故障经历分享
- How to batch output EAN13 code to PDF
- Kubecon2021 video collection
- How to set the website construction title bar drop-down
猜你喜欢

Hackinglab penetration test question 8:key can't find it again

Save: software analysis, verification and test platform

解密抖音春节红包背后的技术设计与实践

应用实践 | Apache Doris 整合 Iceberg + Flink CDC 构建实时湖仓一体的联邦查询分析架构

Beauty of script │ VBS introduction interactive practice

SLSA: 成功SBOM的促进剂

Opengauss Developer Day 2022 was officially launched to build an open source database root community with developers

Application practice | Apache Doris integrates iceberg + Flink CDC to build a real-time federated query and analysis architecture integrating lake and warehouse

蚂蚁获FinQA竞赛冠军,在长文本数值推理AI技术上取得突破
![[technical dry goods] the technical construction route and characteristics of zero trust in ant Office](/img/d1/ce999b9f72bbb8f692c4298b4042aa.png)
[technical dry goods] the technical construction route and characteristics of zero trust in ant Office
随机推荐
Detailed explanation of bitmap optimization
在宇宙的眼眸下,如何正确地关心东数西算?
Go language core 36 lectures (go language practice and application 25) -- learning notes
How do fortress computers log in to the server? What is the role of the fortress machine?
Why is the server fortress machine error code 110? How to solve error code 110?
How to lossless publish API gateway why do you need API gateway?
Website construction is not set to inherit the superior column. How to find a website construction company
为什么你的数据图谱分析图上只显示一个值?
Talk about the problems and solutions of IT enterprise fixed assets management system
Implement sequence restriction on memory operations
How to use FTP to upload websites to the web
CS1.6 service startup tutorial
How many times can the server address and fortress address be entered before the connection is successful? Why did the connection fail?
【技术干货】蚂蚁办公零信任的技术建设路线与特点
如何利用数仓创建时序表
Source code analysis of jmeter5.1 core class testcompiler
Slsa: accelerator for successful SBOM
How to choose the server for website construction, including which servers and how much to rent
為什麼你的數據圖譜分析圖上只顯示一個值?
蚂蚁获FinQA竞赛冠军,在长文本数值推理AI技术上取得突破