Skip to content

SQL Injection Vulnerability in PostgreSQL Driver #120

Closed

Description

@BenMacha

Bug Report

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? needs verification
Licence Apache-2.0

Critical Issues

SQL Injection Vulnerability in PostgreSQL Driver

File: /src/Ting/Driver/Pgsql/Driver.php
Line: 443
Severity: HIGH

$sql = "SELECT currval('$sequenceName')";

Issue: Direct string interpolation of $sequenceName parameter into SQL query without proper escaping or parameterization. This creates a potential SQL injection vulnerability.

Impact: An attacker could potentially execute arbitrary SQL commands if they can control the sequence name parameter.

Recommendation: Use parameterized queries or proper escaping:

$sql = "SELECT currval($1)";
$resultResource = @pg_query_params($this->connection, $sql, [$sequenceName]);

Activity

  1. added a commit that references this issue on Aug 27, 2025
    e5ec5fb
  2. BenMacha commented on Oct 31, 2026

    @BenMacha
    Author

    Fixed upstream in 8e84ea9 (released in 4.1.1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions