当前位置:网站首页>反序列化——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内核浏览器。
边栏推荐
- December 14, 2021: rebuild the queue according to height. Suppose there's a bunch of people out of order
- In the "Internet +" era, how can the traditional wholesale industry restructure its business model?
- Semaphore semaphore details
- Industry 4.0 era: the rise of low code may bring about changes in the pattern of manufacturing industry
- How to use xshell to log in to the server through the fortress machine? How does the fortress machine configure the tunnel?
- Hackinglab penetration test question 8:key can't find it again
- Low code helps live e-commerce bring goods into the manufacturing industry, impacting the traditional supply chain model of the factory
- How to set the website address for website construction can the website be put on record
- Integrated management and control system of 3D intelligent warehousing and logistics park
- Six supervised learning methods: classification of poisonous mushrooms
猜你喜欢

Why is only one value displayed on your data graph?

在宇宙的眼眸下,如何正确地关心东数西算?

openGauss Developer Day 2022正式开启,与开发者共建开源数据库根社区

Beauty of script │ VBS introduction interactive practice

为什么你的数据图谱分析图上只显示一个值?

蚂蚁获FinQA竞赛冠军,在长文本数值推理AI技术上取得突破

Slsa: accelerator for successful SBOM

Pourquoi une seule valeur apparaît - elle sur votre carte de données?

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

Game security - call analysis - write code
随机推荐
Role of API service gateway benefits of independent API gateway
How to set up a website construction map
Get and post are nothing more than TCP links in nature?
How to shut down the server in the fortress machine? What other operations can the fortress machine perform?
Why don't people like PHP?
Talk about the problems and solutions of IT enterprise fixed assets management system
How do new investors open accounts by speculation? Is online account opening safe?
Six supervised learning methods: classification of poisonous mushrooms
How does data Vientiane CI | app quickly integrate HLS encryption to prevent video leakage?
What server is used for website construction? What is the price of the server
Usage of cobaltstrike: Part 1 (basic usage, listener, redirector)
Start learning simple JS
Why is easycvr cascaded to the parent platform not displayed?
What is the API gateway architecture? What are the common gateway types?
Beauty of script │ VBS introduction interactive practice
How do fortress computers log in to the server? What is the role of the fortress machine?
What are the steps required for TFTP to log in to the server through the fortress machine? Operation guide for novice
WordPress plugin wpschoolpress 2.1.16 -'multiple'cross site scripting (XSS)
Overall solution for digital transformation of medical supply chain management
[technical dry goods] the technical construction route and characteristics of zero trust in ant Office