Category

Php

Security vulnerabilities and automated fixes for php issues

15 posts found

critical6 min

How path traversal happens in PHP virtual filesystem adapters and how to fix it

A critical path traversal flaw in `VirtualAdapter.php`'s `resolveMount()` method allowed attackers to escape mounted directory boundaries using sequences like `../../../etc/passwd`. The fix introduces `PathPolicy::normalizeRelative()` to sanitize the remaining path segment before it ever reaches the underlying storage adapter.

#path-traversal#php#cwe-22+3 more
A
anupamme
Sep 7, 2026
critical7 min

How SQL Injection happens in PHP bulk email systems and how to fix it

A critical SQL injection vulnerability in `admin/utilities/bulkEmailSystem.php` allowed attackers to inject arbitrary SQL through unvalidated database names passed from user input. The fix implements strict input validation using regex pattern matching to ensure only safe database identifiers are processed, preventing exploitation of the bulk email functionality.

#sql-injection#php#input-validation+2 more
A
anupamme
Sep 7, 2026
high8 min

How Command Injection Happens in PHP and How to Fix It

The ImportController.php file contained multiple instances of unsafe command execution using `shell_exec()` and `exec()` with external tools like `catdoc` and `pdftotext`. While the file paths were escaped using `escapeshellarg()`, the command names themselves remained non-constant, creating an exploit primitive that could be chained with other vulnerabilities. The fix eliminates these shell command execution patterns entirely.

#command-injection#php#security+2 more
A
anupamme
Sep 7, 2026
high6 min

How OAuth 2.0 Authorization Code Interception happens in PHP and how to fix it

The Weibo OAuth login implementation in `trunk/web/login_weibo.php` was missing PKCE (Proof Key for Code Exchange), allowing attackers with network access to exchange intercepted authorization codes for access tokens. The fix adds cryptographic binding between the authorization request and token exchange using SHA256 code challenges.

#authentication#oauth2#pkce+5 more
A
anupamme
Sep 7, 2026
high7 min

How OAuth Token Binding Prevents Session Hijacking in Weibo Login Implementation

A critical vulnerability in the Weibo OAuth login implementation allowed attackers to replay stolen access tokens across different user sessions. By binding the OAuth access token to the session ID using cryptographic hashing, the fix ensures that intercepted tokens cannot be reused to hijack other sessions, even if compromised via MITM or XSS attacks.

#authentication#oauth#session-fixation+3 more
A
anupamme
Sep 7, 2026
high7 min

How Denial of Service Attacks Happen in PHP Markdown Parsers and How to Fix Them

The league/commonmark library contained a denial of service vulnerability in its Attributes extension that could be triggered by specially crafted markdown with distinctly-named attributes. This vulnerability was fixed in version 2.10.0 by addressing how attribute names are processed during markdown parsing, preventing attackers from exhausting server resources.

#security#denial-of-service#php+3 more
A
anupamme
Sep 4, 2026
high8 min

How Command Injection Happens in PHP Controllers and How to Fix It

A critical command injection vulnerability was discovered in LogsController.php where user-controlled file paths were passed directly to the `exec()` function. The fix replaces shell execution with safe PHP file iteration, eliminating the attack surface while preserving functionality and improving performance.

#command-injection#php#security+2 more
A
anupamme
Aug 31, 2026
critical7 min

How OAuth 2.0 CSRF happens in PHP and how to fix it

A critical OAuth 2.0 CSRF vulnerability in `login_weibo.php` allowed attackers to forge Weibo login requests by exploiting the missing `state` parameter validation. Without this check, an attacker could trick a victim's browser into completing an OAuth flow with the attacker's authorization code, potentially hijacking the victim's session. The fix generates a cryptographically random state token, stores it in the session, and validates it on callback.

#authentication#oauth#csrf+2 more
A
anupamme
Aug 26, 2026
high7 min

How Command Injection happens in PHP shell execution and how to fix it

A command injection vulnerability in `sitrecServer/windProxy.php` allowed user-controlled input to reach a shell command without proper sanitization, creating a remote code execution risk. The `$cycleHour` parameter was passed directly as a format integer (`%d`) into a `sprintf`-built shell command, bypassing the `escapeshellarg()` protection applied to all other arguments. The fix casts `$cycleHour` to an integer and wraps it with `escapeshellarg()`, closing the injection path entirely.

#command-injection#php#shell-exec+2 more
A
anupamme
Aug 26, 2026
high9 min

How Denial of Service via Adjacent Inline Attribute Blocks Happens in PHP and how to fix it

A high-severity denial-of-service vulnerability (GHSA-g2gp-3wwq-f4ph) was discovered in `league/commonmark`, a popular PHP Markdown parsing library. The flaw allows an attacker to craft Markdown input containing adjacent inline attribute blocks that trigger catastrophic processing, potentially exhausting server resources. Upgrading from version 2.7.1 to 2.9.0 resolves the issue by hardening how the parser handles these malformed constructs.

#security#php#denial-of-service+2 more
A
anupamme
Aug 26, 2026
high8 min

How Command Injection happens in PHP and how to fix it

A high-severity command injection vulnerability was discovered in `lib/Controller/Helper.php` where the `corruptline()` method used `exec()` to run sed and awk commands with user-controlled input. The fix replaced all shell command execution with native PHP file operations using `SplFileObject`, eliminating the command injection attack surface entirely.

#php#command-injection#security+4 more
A
anupamme
Aug 22, 2026
critical7 min

How SQL Injection happens in PHP PDO queries and how to fix it

A critical SQL injection vulnerability was discovered in the `getOfficialContests()` method of ContestRepository.php, where the `$site_id` parameter was directly interpolated into a SQL query string instead of using prepared statements. This vulnerability allowed attackers to inject arbitrary SQL commands and potentially access or manipulate the entire contest database. The fix replaced `pdo->query()` with `pdo->prepare()` and proper parameter binding.

#sql-injection#php#pdo+4 more
A
anupamme
Aug 10, 2026