Skip to content

Latest commit

 

History

History
74 lines (61 loc) · 5.33 KB

File metadata and controls

74 lines (61 loc) · 5.33 KB

Threat Model Analysis for symfony/symfony

  • Description: APP_DEBUG=true in production exposes sensitive information (file paths, credentials, code) via detailed error messages and the Web Profiler, allowing attackers to gain insights for further attacks.
  • Impact: Complete information disclosure, potentially leading to full system compromise.
  • Affected Symfony Component: Kernel, Web Profiler, Error Handler.
  • Risk Severity: Critical
  • Mitigation Strategies:
    • Enforce APP_DEBUG=false in production. Use environment variables and verify server configuration.
    • Audit server configurations regularly.
    • Implement monitoring/alerting for debug mode detection.
  • Description: Attackers craft malicious sites that send unauthorized requests on behalf of authenticated users if CSRF protection is disabled or improperly implemented, allowing actions like changing user data or making purchases.
  • Impact: Unauthorized actions performed on behalf of users, leading to data modification, account takeover, or financial loss.
  • Affected Symfony Component: Form Component, Security Component (CSRF protection).
  • Risk Severity: High
  • Mitigation Strategies:
    • Enable global CSRF protection (config/packages/framework.yaml).
    • Verify all forms modifying data include and validate the CSRF token. Do not disable CSRF protection.
    • Explicitly include and validate CSRF tokens in custom form handling.
    • Educate developers on CSRF protection.
  • Description: Attackers manipulate route parameters (e.g., /users/{id}) to access unauthorized resources if the application doesn't properly validate the parameter, potentially accessing other users' data.
  • Impact: Unauthorized data access, potential data modification/deletion, privacy violation.
  • Affected Symfony Component: Routing Component, Controller Actions, Validation Component.
  • Risk Severity: High
  • Mitigation Strategies:
    • Use Symfony's Validation component to validate route parameters (constraints).
    • Implement robust input validation/sanitization in controller actions.
    • Use type hinting in controller actions.
    • Consider ParamConverters for automatic validation.
  • Description: Attackers exploit vulnerabilities in application-specific custom security providers, voters, or authenticators, bypassing authentication, escalating privileges, or impersonating users.
  • Impact: Complete compromise of application security, leading to unauthorized access, data breaches, and system takeover.
  • Affected Symfony Component: Security Component (custom providers, voters, authenticators).
  • Risk Severity: Critical
  • Mitigation Strategies:
    • Thoroughly review and test all custom security logic.
    • Prefer Symfony's built-in providers and voters.
    • Employ robust unit and integration testing for security code.
    • Conduct regular security audits.
    • Follow the principle of least privilege.
  • Description: The application deserializes data from untrusted sources using Symfony's Serializer without proper validation, allowing attackers to inject malicious data that executes arbitrary code upon deserialization.
    • Impact: Remote code execution, complete system compromise.
    • Affected Symfony Component: Serializer Component.
    • Risk Severity: Critical
    • Mitigation Strategies:
      • Avoid deserializing data from untrusted sources. Use safe formats (JSON with schema) and avoid object instantiation.
      • Use a secure Serializer configuration. Avoid enabling exploitable features.
      • Thoroughly validate deserialized data.
      • Consider dedicated security libraries for untrusted data.
  • Description: Attackers manipulate object identifiers (e.g., primary keys) passed to Doctrine ORM to access or modify objects they shouldn't have access to, bypassing authorization checks.
  • Impact: Unauthorized data access, modification, or deletion.
  • Affected Symfony Component: Doctrine ORM (used within controllers and services).
  • Risk Severity: High
  • Mitigation Strategies:
    • Never directly expose internal object identifiers. Use UUIDs or non-sequential IDs.
    • Always check user authorization before accessing/modifying objects. Use Symfony's security voters.
    • Avoid relying solely on object IDs for authorization. Implement additional checks.
    • Use Doctrine's query builder or DQL, not manual string concatenation.