# Deserializations

### PHP Deserialization

Main thing you need to understand about Deserialization is that you can **control the properties of the object** created.

When the properties you have set are passed into magic methods, PHP object injection vulnerabilities occur. You can also reach **any class, and control the properties of that class**, if there is a vulnerability.

If there is a method being called from a property we can control such as: **$this->redis->close();** and as we change the redis property to other class object we can affectively call any close() method.&#x20;

## References

[**PayloadsAllTheThings \[ PHP Deserialization Cheat Sheet \]**](https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Insecure%20Deserialization/PHP.md)

[**\[ Ippsec Youtube Video \]**](https://www.youtube.com/watch?v=HaW15aMzBUM)

[**HackTricks \[Deserialization\]**](https://book.hacktricks.xyz/pentesting-web/deserialization)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://100pingissues.gitbook.io/oswe/pre-requisites-1/php-object-injection..md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
