Php Csrf Protection Disabled
Description
Detects when CSRF protection is explicitly disabled in PHP Symfony applications. Cross-Site Request Forgery (CSRF) protection is a critical security feature that prevents unauthorized commands from being transmitted from a user that the website trusts, so disabling it exposes the application to CSRF attacks.
Detection Strategy
• Looks for Symfony framework imports including OptionsResolver, DependencyInjection components, or AbstractController
• Checks configuration settings in form definitions where csrf_protection is set to false
• Examines container builder configurations where csrf protection features are disabled
• Reports vulnerability when CSRF protection is explicitly turned off in either forms or global configurations
Vulnerable code example
<?php
use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolver;
class TaskType extends AbstractType
{
public function configureOptions(OptionsResolver $resolver)
{...✅ Secure code example
<?php
use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolver;
class TaskType extends AbstractType
{
public function configureOptions(OptionsResolver $resolver)
{...Search for vulnerabilities in your apps for free with Fluid Attacks' automated security testing! Start your 21-day free trial and discover the benefits of the Continuous Hacking Essential plan. If you prefer the Advanced plan, which includes the expertise of Fluid Attacks' hacking team, fill out this contact form.