Absence of Anti-CSRF Tokens in the Search Form of OPS3.3

Dear PKP staffs and Forum members,

I am currently operating OPS3.3.0.8 (PHP8.1).
I conducted a dynamic scan with a vulnerability assessment tool (OWASP ZAP) on the search form of OPS, and the diagnostic report identified the following vulnerability:

Risk Level: Low (Medium) Absence of Anti-CSRF Tokens

Description:
No Anti-CSRF tokens were found in an HTML submission form.
CSRF has primarily been used to perform an action against a target site using the victim’s privileges, but recent techniques have been discovered that allow information disclosure by gaining access to the response. The risk of information disclosure increases significantly when the target site is vulnerable to XSS because XSS can serve as a platform for CSRF, enabling the attack to operate within the bounds of the same-origin policy.

Target URL: https://my-ops-server.com/index.php/ops/search/search?csrfToken=0b9924d24c4a5c4e30f7888a7dd9305c&query=
※The domain part is a dummy.

While the risk level is noted as Low, I’m concerned and would appreciate confirmation.

The term “Absence of Anti-CSRF Tokens” indicates that the scanned HTML form does not contain Anti-CSRF tokens, which are generally recognized as a protective measure against Cross-Site Request Forgery (CSRF) attacks.

As can be seen from the URL above, it seems that an csrfToken is generated when the search button is pressed in OPS, but it appears that this token is not being correctly transmitted or validated.

To resolve this issue, it is recommended to include an appropriate Anti-CSRF token in the respective form, and to ensure this token is validated on the server-side when the form is submitted. This approach is expected to verify that the form submission originates from a legitimate session, thereby reducing the risk of CSRF attacks.

Could you please confirm if my understanding of the behavior of OPS’s CSRF tokens is correct and advise on a solution?

Best regards,
Minoru Tanabe.

Hi @Minoru_Tanabe,

The search form is public and shouldn’t have CSRF checks. Those should only be used on forms that modify the system’s state.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Hi @asmecher ,

Thank you for your response. For now, I’ve understood that CSRF token validation is not necessary for the search form.
The vulnerability tool’s warning is merely a low-level indication that there might be a potential vulnerability to CSRF attacks, so it seems it can be safely ignored.

However, I have one point of clarification: why does OPS issue CSRF tokens for the search form if there is no need for validation in any subsequent process?

Best regards,
Minoru Tanabe.

Hi @Minoru_Tanabe,

The csrfToken in the search URL is harmless, but if you’d like to remove it, you can apply this change.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher ,
Thank you for the clarification. I will consider this and take appropriate action.

Best regards,
Minoru Tanabe.