// For flags

CVE-2021-32829

Post-authentication Remote Code Execution (RCE) in ZStack REST API

Severity Score

9.9
*CVSS v3.1

Exploit Likelihood

*EPSS

Affected Versions

*CPE

Public Exploits

1
*Multiple Sources

Exploited in Wild

-
*KEV

Decision

-
*SSVC
Descriptions

ZStack is open source IaaS(infrastructure as a service) software aiming to automate datacenters, managing resources of compute, storage, and networking all by APIs. Affected versions of ZStack REST API are vulnerable to post-authentication Remote Code Execution (RCE) via bypass of the Groovy shell sandbox. The REST API exposes the GET zstack/v1/batch-queries?script endpoint which is backed up by the BatchQueryAction class. Messages are represented by the APIBatchQueryMsg, dispatched to the QueryFacadeImpl facade and handled by the BatchQuery class. The HTTP request parameter script is mapped to the APIBatchQueryMsg.script property and evaluated as a Groovy script in BatchQuery.query the evaluation of the user-controlled Groovy script is sandboxed by SandboxTransformer which will apply the restrictions defined in the registered (sandbox.register()) GroovyInterceptor. Even though the sandbox heavily restricts the receiver types to a small set of allowed types, the sandbox is non effective at controlling any code placed in Java annotations and therefore vulnerable to meta-programming escapes. This issue leads to post-authenticated remote code execution. For more details see the referenced GHSL-2021-065. This issue is patched in versions 3.8.21, 3.10.8, and 4.1.0.

ZStack es un software IaaS (infraestructura como servicio) de código abierto cuyo objetivo es automatizar los centros de datos, administrando los recursos de computación, almacenamiento y red, todo ello mediante API. Las versiones afectadas de la API REST de ZStack son vulnerables a una ejecución de código remota (RCE) después de la autenticación, por medio de una omisión del sandbox shell de Groovy. La API REST expone el endpoint GET zstack/v1/batch-queries?script que está respaldado por la clase BatchQueryAction. Los mensajes son representados por el APIBatchQueryMsg, enviados a la fachada QueryFacadeImpl y manejados por la clase BatchQuery. El script del parámetro de petición HTTP se asigna a la propiedad APIBatchQueryMsg.script y se evalúa como un script Groovy en BatchQuery.query la evaluación del script Groovy controlado por el usuario es sandboxed por SandboxTransformer que aplicará las restricciones definidas en el registrado (sandbox.register()) GroovyInterceptor. A pesar de que el sandbox restringe fuertemente los tipos del receptor a un pequeño conjunto de tipos permitidos, el sandbox no es efectivo en el control de cualquier código colocado en las anotaciones de Java y por lo tanto es vulnerable a los escapes de meta-programación. Este problema conlleva a una ejecución de código remota post-autenticada. Para más detalles, consulte la referencia GHSL-2021-065. Este problema está parcheado en versiones 3.8.21, 3.10.8 y 4.1.0.

*Credits: N/A
CVSS Scores
Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High
Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
None
Attack Vector
Network
Attack Complexity
Low
Authentication
Single
Confidentiality
Partial
Integrity
Partial
Availability
Partial
* Common Vulnerability Scoring System
SSVC
  • Decision:-
Exploitation
-
Automatable
-
Tech. Impact
-
* Organization's Worst-case Scenario
Timeline
  • 2021-05-12 CVE Reserved
  • 2021-08-17 CVE Published
  • 2024-08-03 CVE Updated
  • 2024-08-03 First Exploit
  • 2024-09-19 EPSS Updated
  • ---------- Exploited in Wild
  • ---------- KEV Due Date
CWE
  • CWE-94: Improper Control of Generation of Code ('Code Injection')
  • CWE-863: Incorrect Authorization
CAPEC
Affected Vendors, Products, and Versions
Vendor Product Version Other Status
Vendor Product Version Other Status <-- --> Vendor Product Version Other Status
Zstack
Search vendor "Zstack"
Rest Api
Search vendor "Zstack" for product "Rest Api"
>= 2.2.4 < 3.8.21
Search vendor "Zstack" for product "Rest Api" and version " >= 2.2.4 < 3.8.21"
-
Affected
Zstack
Search vendor "Zstack"
Rest Api
Search vendor "Zstack" for product "Rest Api"
>= 3.10.0 < 3.10.8
Search vendor "Zstack" for product "Rest Api" and version " >= 3.10.0 < 3.10.8"
-
Affected