CVE-2023-5687 (published 2023-10-20T17:15Z)

Cross-Site Request Forgery (CSRF) in GitHub repository mosparo/mosparo prior to 1.0.3.

CVSS v3 base score: 8.8, HIGH (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-352
cwe_name: Cross-Site Request Forgery (CSRF)
description: The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
extended_description: When a web server is designed to receive a request from a client without any mechanism for verifying that it was intentionally sent, then it might be possible for an attacker to trick a client into making an unintentional request to the web server which will be treated as an authentic request. This can be done via a URL, image load, XMLHttpRequest, etc. and can result in exposure of data or unintended code execution.
         

Fix information:
repo_url: https://github.com/mosparo/mosparo
commit_details: repo_url: https://github.com/mosparo/mosparo
author: Matthias Zobrist
author_date: 2023-10-14 10:43:07+02:00
msg: Security: Added the CSRF token to the logout URL
As reported by @qqliunian2001 on huntr.dev, it is possible to force the logout of a user. This is because we did not set up any protection against direct access to the logout route.

With this fix, we use the CSRF option from Symfony to protect the logout functionality. If no CSRF token is provided, the logout will not work.
repository: repo_url: https://github.com/mosparo/mosparo
repo_name: mosparo/mosparo
description: The modern spam protection. Protects your forms from spam by simply checking the content. Open source, Free to use, Accessible, and Self-Hosted.
repo_language: PHP
owner: mosparo
file_changes: filename: security.yaml
change_type: ModificationType.MODIFY
diff: @@ -51,6 +51,8 @@ security:
                 default_target_path: project_list
             logout:
                 path: security_logout
+                csrf_parameter: token
+                csrf_token_generator: security.csrf.token_manager
             two_factor:
                 auth_form_path: 2fa_login
                 check_path: 2fa_login_check

programming_language: Markdown
filename: base.html.twig
change_type: ModificationType.MODIFY
diff: @@ -72,7 +72,7 @@
                                         <i class="ti ti-adjustments"></i>
                                         {{ 'account.title'|trans }}
                                     </a>
-                                    <a href="{{ path('security_logout') }}" class="dropdown-item">
+                                    <a href="{{ path('security_logout', {'token' : csrf_token('logout')}) }}" class="dropdown-item">
                                         <i class="ti ti-logout"></i>
                                         {{ 'security.logout.title'|trans }}
                                     </a>

programming_language: HTML
filename: login.html.twig
change_type: ModificationType.MODIFY
diff: @@ -36,7 +36,7 @@
 
         {% if app.user %}
             <div class="alert alert-info">
-                {{ 'security.login.youAreLoggedIn'|trans({'%username%': app.user.username}, 'mosparo') }}. <a href="{{ path('security_logout') }}">{{ 'security.logout.title'|trans }}</a>
+                {{ 'security.login.youAreLoggedIn'|trans({'%username%': app.user.username}, 'mosparo') }} <a href="{{ path('security_logout', {'token' : csrf_token('logout')}) }}">{{ 'security.logout.title'|trans }}</a>
             </div>
         {% endif %}
 

programming_language: HTML