GHSA-733v-p3h5-qpq7
GHSA-733v-p3h5-qpq7 · GraphQL Armor Cost-Limit Plugin Bypass via Introspection Query Obfuscation
CVSS 5.3 · Средний · Есть исправление
Затронуты ли вы?
- @escape.tech/graphql-armor-cost-limit npmОбновитесь до 2.4.2
Как узнать установленную версию:
npm ls @escape.tech/graphql-armor-cost-limitБесплатная проверка подсветит, требует ли внимания @escape.tech/graphql-armor-cost-limit и остальные зависимости: проверьте lock-файл проекта или весь сервер командой ниже. Без регистрации. Номера CVE, версии исправлений и рекомендации — в платном мониторинге.
curl -fsSL https://ru.patchfirst.dev/check.sh | shЗдесь приведены факты из открытых источников об уязвимостях. Перед обновлением ознакомьтесь с исходным сообщением.
### Summary A query cost restriction using the `cost-limit` can be bypassed if `ignoreIntrospection` is enabled (which is the default configuration) by naming your query/fragment `__schema`. ### Details At the start of the `computeComplexity` function, we have the following check for `ignoreIntrospection` option: ```ts if (this.config.ignoreIntrospection && 'name' in node && node.name?.value === '__schema') { return 0; } ``` However, the `node` can be `FieldNode | FragmentDefinitionNode | InlineFragmentNode | OperationDefinitionNode | FragmentSpreadNode` So, for example, sending the following query ```gql query hello { books { title } } ``` would create an `OperationDefinitionNode` with `node.name.value == 'hello'` The proper way to handle this would be to check for the `__schema` field, which would create a `FieldNode`. The fix is ```ts if ( this.config.ignoreIntrospection && 'name' in node && node.name?.value === '__schema' && node.kind === Kind.FIELD ) { return 0; } ``` to assert that the node must be a `FieldNode` ### PoC ```gql query { ...__schema } fragment __schema on Query { books { title author } } ``` ```gql query __schema { books { title author } } ``` ### Impact Applications using GraphQL Armor Cost Limit plugin with `ignoreIntrospection` enabled. ### Fix: Fixed on [772](https://github.com/Escape-Technologies/graphql-armor/pull/772). A quick patch would be to set `ignoreIntrospection` to false.
- Опубликовано
- Обновлено
Стек: node
Затронутые продукты и версии
@escape.tech/graphql-armor-cost-limit npm
- Затронутые диапазоны версий
- SEMVER: < 2.4.2
Обновитесь до 2.4.2
Первоисточники
- https://github.com/Escape-Technologies/graphql-armor/security/advisories/GHSA-733v-p3h5-qpq7
- https://github.com/Escape-Technologies/graphql-armor/pull/772
- https://github.com/Escape-Technologies/graphql-armor/commit/5a329541cf32a359ee1f69748738f91231b26eba
- https://github.com/Escape-Technologies/graphql-armor
- https://osv.dev/vulnerability/GHSA-733v-p3h5-qpq7