statistics.php can exit early and prevent output errors

Created on 16 November 2015, about 9 years ago
Updated 20 May 2024, 6 months ago

Problem/Motivation

Original report by blasthaus to security.drupal.org - security team decided this is not a vulnerability and can be fixed publicly.

This module has a Denial of Service (DOS) vulnerability.

You can see this vulnerability by:

  1. Enabling the module or have the module disabled but not yet uninstalled and have set both
    • "Count content views" and
    • On D7 only, "Use Ajax to increment the counter" module settings.
  2. As someone with no permission, send a post request to the path /modules/statistics/statistics.php with a POST param of nid set to a numeric value out of range i.e. > int(11).

This causes a PDOException and could be used as an attack vector if repeatedly called to try and take down a site.

Furthermore, per the minimal Drupal bootstrap in this file, no error would ever be sent to watchdog.

Proposed resolution

  • do early exit when not integer NID is passed
  • add try/catch to prevent any data send on error

Remaining tasks

Agree that this changes enough and commit

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Fixed

Version

1.0

Component
Statistics 

Last updated 5 days ago

No maintainer
Created by

🇬🇧United Kingdom catch

Live updates comments and jobs are added and updated live.
  • Security improvements

    It makes Drupal less vulnerable to abuse or misuse. Note, this is the preferred tag, though the Security tag has a large body of issues tagged to it. Do NOT publicly disclose security vulnerabilities; contact the security team instead. Anyone (whether security team or not) can apply this tag to security improvements that do not directly present a vulnerability e.g. hardening an API to add filtering to reduce a common mistake in contributed modules.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024