CVE-2024-22196
Authenticated (user role) SQL injection in `OrderAndPaginate` (GHSL-2023-270)
Nginx-UI is an online statistics for Server Indicators Monitor CPU usage, memory usage, load average, and disk usage in real-time. This issue may lead to information disclosure. 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. This issue has been patched in version 2.0.0.beta.9.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- High
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- High
- Integrity
- Low
- Availability
- Low
Exploit likelihood
What each source reports
CVE List Score used
7.0
Authenticated (user role) SQL injection in `OrderAndPaginate` (GHSL-2023-270)
Nginx-UI is an online statistics for Server Indicators Monitor CPU usage, memory usage, load average, and disk usage in real-time. This issue may lead to information disclosure. 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. This issue has been patched in version 2.0.0.beta.9.
- Record
CVE-2024-22196- CVSS 3.1
- 7.0 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:L - Weakness
- CWE-89
- Updated
- 2026-11-02
EUVDEUVD-2024-0362
7.0
Nginx-UI is an online statistics for Server Indicators Monitor CPU usage, memory usage, load average, and disk usage in real-time. This issue may lead to information disclosure. 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. This issue has been patched in version 2.0.0.beta.9.
- Record
EUVD-2024-0362- CVSS 3.1
- 7.0 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:L - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-h374-mm57-879c
7.0
Authenticated (user role) SQL injection in `OrderAndPaginate` (GHSL-2023-270)
Summary
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.
Proof of Concept
Based on this setup using
uozi/nginx-ui:v2.0.0-beta.7. In order to exploit this issue, we need to find a place where theOrderAndPaginatefunction is used. We can find it in theGET /api/dns_credentialsendpoint.
func GetDnsCredentialList(c *gin.Context) {
cosy.Core[model.DnsCredential](c).SetFussy("provider").PagingList()
}
The PagingList function is defined as follows:
func (c *Ctx[T]) PagingList() {
data, ok := c.PagingListData()
if ok {
c.ctx.JSON(http.StatusOK, data)
}
}
And the PagingListData function is defined as follows:
func (c *Ctx[T]) PagingListData() (*model.DataList, bool) {
result, ok := c.result()
if !ok {
return nil, false
}
result = result.Scopes(c.OrderAndPaginate())
...
}
Using the following request, an attacker can retrieve arbitrary values by checking the order used by the query. That is, the result of the comparison will make the response to be ordered in a specific way.
GET /api/dns_credentials?sort_by=(CASE+WHEN+(SELECT+1)=1+THEN+id+ELSE+updated_at+END)+ASC+--+ HTTP/1.1
Host: 127.0.0.1:8080
Authorization: <<JWT TOKEN>
You can notice the order change by changing =1 to =2, and so the comparison will return false and the order will be updated_at instead of id.
Impact
This issue may lead to Information Disclosure
- Record
GHSA-h374-mm57-879c- CVSS 3.1
- 7.0 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:L - Weakness
- CWE-89
- Updated
- 2026-11-02
NVD
7.0
Nginx-UI is an online statistics for Server Indicators Monitor CPU usage, memory usage, load average, and disk usage in real-time. This issue may lead to information disclosure. 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. This issue has been patched in version 2.0.0.beta.9.
- Record
CVE-2024-22196- CVSS 3.1
- 7.0 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:L - CVSS 3.1
- 6.5 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N - Weakness
- CWE-89
- Updated
- 2026-11-02
OSV
7.0
Authenticated (user role) SQL injection in `OrderAndPaginate` (GHSL-2023-270)
Nginx-UI is an online statistics for Server Indicators Monitor CPU usage, memory usage, load average, and disk usage in real-time. This issue may lead to information disclosure. 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. This issue has been patched in version 2.0.0.beta.9.
- Record
CVE-2024-22196- CVSS 3.1
- 7.0 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:L - Weakness
- CWE-89
- Updated
- 2026-11-02
OSVGHSA-h374-mm57-879c
7.0
Authenticated (user role) SQL injection in `OrderAndPaginate` (GHSL-2023-270)
Summary
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.
Proof of Concept
Based on this setup using
uozi/nginx-ui:v2.0.0-beta.7. In order to exploit this issue, we need to find a place where theOrderAndPaginatefunction is used. We can find it in theGET /api/dns_credentialsendpoint.
func GetDnsCredentialList(c *gin.Context) {
cosy.Core[model.DnsCredential](c).SetFussy("provider").PagingList()
}
The PagingList function is defined as follows:
func (c *Ctx[T]) PagingList() {
data, ok := c.PagingListData()
if ok {
c.ctx.JSON(http.StatusOK, data)
}
}
And the PagingListData function is defined as follows:
func (c *Ctx[T]) PagingListData() (*model.DataList, bool) {
result, ok := c.result()
if !ok {
return nil, false
}
result = result.Scopes(c.OrderAndPaginate())
...
}
Using the following request, an attacker can retrieve arbitrary values by checking the order used by the query. That is, the result of the comparison will make the response to be ordered in a specific way.
GET /api/dns_credentials?sort_by=(CASE+WHEN+(SELECT+1)=1+THEN+id+ELSE+updated_at+END)+ASC+--+ HTTP/1.1
Host: 127.0.0.1:8080
Authorization: <<JWT TOKEN>
You can notice the order change by changing =1 to =2, and so the comparison will return false and the order will be updated_at instead of id.
Impact
This issue may lead to Information Disclosure
- Record
GHSA-h374-mm57-879c- CVSS 3.1
- 7.0 High
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:L - Weakness
- CWE-89
- Updated
- 2026-11-02
OSVGO-2024-2463 No score
SQL injection in github.com/0xJacky/Nginx-UI
SQL injection in github.com/0xJacky/Nginx-UI
- Record
GO-2024-2463- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
github.com/0xJacky/Nginx-UIGo |
before 1.9.10-0.20231219195202-ec93ab05a3ec | 1.9.10-0.20231219195202-ec93ab05a3ec |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2024-22196 is a high vulnerability (CVSS 7.0) in 0xjacky Nginx-ui, published January 11, 2024. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.58%, the 48th percentile. Fixed in github.com/0xJacky/Nginx-UI 1.9.10-0.20231219195202-ec93ab05a3ec.
References
github.com/0xJacky/nginx-ui/security/advisories/GHSA-h374-mm57-879c
github.com/0xJacky/nginx-ui/commit/ec93ab05a3ecbb6bcf464d9dca48d74452df8a5b
github.com/0xjacky/nginx-ui/blob/04bf8ec487f06ab17a9fb7f34a28766e5f53885e/model/model.go
nvd.nist.gov/vuln/detail/CVE-2024-22196
github.com/advisories/GHSA-h374-mm57-879c
github.com/CVEProject/cvelistV5/tree/main/cves/2024/22xxx/CVE-2024-22196.json
github.com/0xJacky/nginx-ui