Advisory Database
  • Advisories
  • Dependency Scanning
  1. golang
  2. ›
  3. github.com/0xJacky/Nginx-UI
  4. ›
  5. CVE-2024-22196

CVE-2024-22196: Authenticated (user role) SQL injection in `OrderAndPaginate` (GHSL-2023-270)

January 11, 2024 (updated July 6, 2026)

The OrderAndPaginate function is used to order and paginate data. It is defined as follows:

func OrderAndPaginate(c *gin.Context) func(db *gorm.DB) *gorm.DB {
return func(db *gorm.DB) *gorm.DB {
sort := c.DefaultQuery("order", "desc")

order := fmt.Sprintf("`%s` %s", DefaultQuery(c, "sort_by", "id"), sort)
db = db.Order(order)

...
}
}

By using DefaultQuery, the "desc" and "id" values are used as default values if the query parameters are not set. Thus, the order and sort_by query parameter are user-controlled and are being appended to the order variable without any sanitization. The same happens with SortOrder, but it doesn’t seem to be used anywhere.

func SortOrder(c *gin.Context) func(db *gorm.DB) *gorm.DB {
return func(db *gorm.DB) *gorm.DB {
sort := c.DefaultQuery("order", "desc")
order := fmt.Sprintf("`%s` %s", DefaultQuery(c, "sort_by", "id"), sort)
return db.Order(order)
}
}

This issue was found using CodeQL for Go: Database query built from user-controlled sources.

References

  • github.com/0xJacky/nginx-ui/commit/ec93ab05a3ecbb6bcf464d9dca48d74452df8a5b
  • github.com/0xJacky/nginx-ui/security/advisories/GHSA-h374-mm57-879c
  • github.com/0xjacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/model/model.go
  • github.com/0xjacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/model/model.go
  • github.com/0xjacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/model/model.go
  • github.com/advisories/GHSA-h374-mm57-879c
  • nvd.nist.gov/vuln/detail/CVE-2024-22196

Code Behaviors & Features

Detect and mitigate CVE-2024-22196 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions before 1.9.10-0.20231219195202-ec93ab05a3ec

Fixed versions

  • 1.9.10-0.20231219195202-ec93ab05a3ec

Solution

Upgrade to version 1.9.10-0.20231219195202-ec93ab05a3ec or above.

Impact 7 HIGH

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:L

Learn more about CVSS

Weakness

  • CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')

Source file

go/github.com/0xJacky/Nginx-UI/CVE-2024-22196.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 08 Nov 2026 00:15:19 +0000.