llamaCVEVulnerability Intelligence
/
Advisory · GitHub · npm · apollo-server

GHSA-2P3C-P3QW-69R4

The graphql-upload library included in Apollo Server 2 is vulnerable to CSRF mutations

Parche disponible
Descargar PNG JSON
CVSS
—
medium
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche a -140 d de la divulgación
Exposición1.501 dDesde la divulgación, 12 oct 2022, 9:15 a. m.
Detección1.496 dDesde la divulgación hasta su ingreso al índice
Decisión estimadaSeguir
Remediar en la ventana regular de mantenimiento
Estimación de Llama con el árbol SSVC de CISA a partir de la severidad declarada por GHSA (media) y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, no automatizable e impacto técnico parcial. Hay versiones corregidas disponibles.
Parche en la próxima ventana y listo, campeón.Sin prisa pero sin pausa, como yo en el páramo.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Modificada
Explotación
Remediación
Parche 2.25.4
Monitoreo
Detectada
25 may 22
12 oct 22
31 jul 23
17 nov 26
21 nov 26
25 may 22
9 jul 23
23 ago 24
7 oct 25
21 nov 26
FechaFaseEventoDetalle
Remediación Parche 2.25.4 apollo-server · -140 d desde divulgación
Divulgación Publicada GHSA-2P3C-P3QW-69R4 divulgada
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

### Impact
The graphql-upload https://www.npmjs.com/package/graphql-upload npm package can execute GraphQL operations contained in `content-type: multipart/form-data` POST requests. Because they are POST requests, they can contain GraphQL mutations. Because they use `content-type: multipart/form-data`, they can be "simple requests" which are not preflighted by browsers.

If your GraphQL server uses `graphql-upload` and uses `SameSite=None` cookies for authentication, then JS on any origin can cause browsers to send cookie-authenticated mutations to your GraphQL server, which will be executed without checking your CORS policy first. (The attack won't be able to see the response to the mutation if your CORS policy is set up properly, but the side effects of the mutation will still happen.)

Additionally, if your GraphQL server uses `graphql-upload` and relies on network properties for security (whether by explicitly looking at the client's IP address or by only being available on a private network), then JS on any origin can cause browsers (which may be on a private network or have an allowed IP address) to send mutations to your GraphQL server, which will be executed without checking your CORS policy first. (This attack does not require your server to use cookies. It is in some cases prevented by some browsers such as Chrome.)

Apollo Server 2 bundled `graphql-upload` and enabled it by default, so by default, Apollo Server 2 servers are vulnerable to these CSRF attacks. (Apollo Server 1 did not bundle `graphql-upload`. Apollo Server 3 no longer bundles `graphql-upload`, although AS3's docs do document how to manually integrate with `graphql-upload`.) It is enabled even if your server makes no use of the upload functionality.

If you are running Apollo Server 2 (older than v2.25.4) and do not specify `uploads: false` to `new ApolloServer`, then you are vulnerable to this CSRF mutation attack.

We recently introduced an opt-in CSRF prevention feature in Apollo Server 3.7. This feature successfully protects against CSRF even if you have manually integrated your AS3.7 server with `graphql-upload`. However, this feature is not available for Apollo Server 2.

### Patches
If you are using Apollo Server 2 and do *not* actually use uploads in your schema (ie, the `Upload` scalar is not used as the argument to any field or in any input object definition, and you do not specify `uploads` to `new ApolloServer`), then upgrading to Apollo Server 2.25.4 will automatically disable `graphql-upload` in your server. This will fix the CSRF mutation vulnerability.

Upgrading to v2.25.4 does still leave your server vulnerable to non-mutation CSRF attacks such as timing attacks against query operations. To protect yourself against these potentially lower impact CSRF attack, we encourage upgrading to Apollo Server v3.7 and enabling CSRF prevention. See the Apollo Server 3 migration guide https://www.apollographql.com/docs/apollo-server/migration/ and the CSRF prevention docs https://www.apollographql.com/docs/apollo-server/security/cors/#preventing-cross-site-request-forgery-csrf for details.

If you are actively using the uploads feature with Apollo Server 2, then upgrading to v2.25.4 will not disable the feature and you will still be vulnerable. You should instead upgrade to v3.7 and enable the CSRF prevention feature.

If you are manually integrating the `graphql-upload` package with any version of Apollo Server (or any Node GraphQL server) and need to continue using the feature, then you must enable some sort of CSRF prevention feature to fix this vulnerability. We recommend the CSRF prevention feature in Apollo Server 3.7.

### Workarounds
Instead of upgrading your Apollo Server 2 server, you can specify `uploads: false` to `new ApolloServer` to disable the `graphql-upload` integration and protect against CSRF mutations. (Only do this if you do not actually use the uploads feature in your server!) This will still leave your server vulnerable to non-mutation CSRF attacks such as timing attacks against query operations; you need to upgrade to v3.7 and enable CSRF prevention to protect against these attacks.

### Related work
- PR adding a Security section to the GraphQL multipart request spec https://github.com/jaydenseric/graphql-multipart-request-spec/pull/64

Versiones

Rangos afectados

Afectada Corregida Última
apollo-server≥ 2.0.0 < 2.25.4
2.0.0
2.25.4
3.13.0
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
npmapollo-server
Corregida 2.25.4 -140 d 3.13.0 no afectada
Versiones corregidas2.25.4
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Otrahttps://github.com/apollographql/apollo-server/security/advisories/GHSA-2p3c-p3qw-69r4
Otrahttps://github.com/jaydenseric/graphql-multipart-request-spec/pull/64
Otrahttps://github.com/apollographql/apollo-server/commit/82d44985ddca8e61557957d67f41e9c1a705a5ca
Otrahttps://github.com/apollographql/apollo-server

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.