Injection

Node.js Express Injection Fix: CVE-2026-28805 [CVE-2026-28805]

[Fixed Apr 2026] Updated CVE-2026-28805

Overview

CVE-2026-28805 describes a time-based blind SQL injection in OpenSTAManager prior to version 2.10.2, where an authenticated user’s input could be concatenated directly into a SQL WHERE clause. Because the user-supplied value was read and interpolated into the query as a bare expression without sanitization or parameterization, an attacker could craft input to execute arbitrary SQL, potentially extracting usernames, password hashes, financial records, and other data from the MySQL database. The vulnerability is categorized under CWE-89 (SQL Injection) and was patched in 2.10.2. In real-world Node.js (Express) applications, this class of vulnerability manifests when untrusted input is interpolated into SQL strings, enabling an attacker to influence the query plan or time-based behavior to reveal data. In a Node.js (Express) context, the risk translates to code that reads a query parameter such as req.query.options?.stato and builds a SQL string by concatenating that value, e.g. `WHERE stato = '${stato}'`. An attacker could supply a crafted stato value to introduce SQL fragments or time-based payloads (for example, using SLEEP(...) in MySQL) to delay responses or infer data. The result is a powerful remote code path for data extraction or denial of service unless proper binding and validation are used. The remediation focuses on eliminating dynamic SQL construction with user input and enforcing strict input validation and parameterization. The recommended remediation is to apply parameterized queries, enforce allowlists for known values, and adopt safer data access patterns (ORMs or query builders that auto-escape). After applying these protections, the app will no longer honor crafted SQL injected via stato, and any time-based behavior will be eliminated, reducing risk even if other insecure input points exist. Finally, incorporate tests and logging to ensure future changes do not reintroduce unsafely interpolated SQL and verify that invalid inputs are rejected early. In summary, this guidance maps the OpenSTAManager CVE-2026-28805 risk to Node.js Express practice: never interpolate user input into SQL, always use parameter binding, and validate inputs against a strict allowlist.

Affected Versions

OpenSTAManager < 2.10.2 (prior to 2.10.2 patch)

Code Fix Example

Node.js (Express) API Security Remediation
```javascript
// Vulnerable and fixed code in a minimal Express app (demonstrative only)
const express = require('express');
const mysql = require('mysql2/promise');
const app = express();

// Build a pool for demonstration; replace with real credentials
const pool = mysql.createPool({
  host: 'localhost', user: 'appuser', password: 'password', database: 'opensta'
});

// Vulnerable route: input is interpolated directly into SQL (CWE-89)
app.get('/payments', async (req, res) => {
  const stato = req.query?.options?.stato; // e.g., options[stato]
  // Vulnerable: direct string interpolation of user input into SQL
  const sql = `SELECT id, username, amount FROM invoices WHERE stato = '${stato}'`;
  try {
    const [rows] = await pool.query(sql);
    res.json(rows);
  } catch (err) {
    res.status(500).send('Database error');
  }
});

// Fixed route: parameterized query with optional allowlist validation
app.get('/payments-secure', async (req, res) => {
  const stato = req.query?.options?.stato;
  const allowed = ['OPEN', 'CLOSED', 'PENDING', 'PAID'];
  if (!allowed.includes(stato)) {
    return res.status(400).send('Invalid stato');
  }
  // Safe: use a parameterized query with a placeholder
  const sql = 'SELECT id, username, amount FROM invoices WHERE stato = ?';
  try {
    const [rows] = await pool.execute(sql, [stato]);
    res.json(rows);
  } catch (err) {
    res.status(500).send('Database error');
  }
});

app.listen(3000, () => console.log('Server running on port 3000'));
```

CVE References

Choose which optional cookies to allow. You can change this any time.