← PHP / Laravel · Contents

PHP-094 / Advanced

Interpreting arbitrary tags when loading YAML (older libraries)

A08:2021 Software and Data Integrity Failures · CWE-502 Deserialization of Untrusted Data

Why is this a problem?

Language-specific extension tags can instantiate arbitrary classes.

How to fix it

php
$cfg = json_decode($request->getContent(), true, 512, JSON_THROW_ON_ERROR);

Further reading