Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • G GLib
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 854
    • Issues 854
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 55
    • Merge requests 55
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • GLib
  • Issues
  • #2782
Closed
Open
Issue created Oct 18, 2022 by Philip Withnall@pwithnall☕Maintainer

GVariant type depth not checked on typedecls in text format variants

oss-fuzz has found a latent issue with GVariant depth restrictions which needs fixing, and should probably be treated as a security issue.

If I have a text-form GVariant [1,2,3,4] and it’s parsed using g_variant_parse() without specifying a type, then adding a deeply-nested typedecl inside it ([1,2,3,4,@mmmm…mmu 0]) will multiply the number of objects created by the nesting depth. This means the number of objects created is not linear in the length of the text-form GVariant, which can be used to perform denial of service attacks.

This is exploitable only in software which parses untrusted text-form GVariants without specifying a type. This is unlikely, and is already a very risky thing for that software to do. For that reason, I don’t think we need to go through coordinated release of fixes or request a CVE number.

I have attached a patch which fixes the issue and includes a text case. It basically causes g_variant_parse() to return G_VARIANT_PARSE_ERROR_RECURSION if faced with a typedecl in a text-form GVariant where the depth of the type in the typedecl would cause the whole variant to become too deeply nested at any point.

0001-gvariant-parser-Reject-deeply-nested-typedecls-in-te.patch

We’ll have to do patch review manually in this issue, in order to keep the fix confidential until it’s ready to release, since GitLab doesn’t yet support confidential MRs (afaik).

I’ve set the due date to 2 days before the oss-fuzz issue becomes public. Sorry for the short notice; I was only reminded of this issue because of an oss-fuzz deadline reminder. This kind of rush could be avoided if it wasn’t just me looking at oss-fuzz issues. We can request up to 2 weeks’ extension on the oss-fuzz deadline if needed, as a fix is in progress.

Edited Oct 18, 2022 by Philip Withnall
Assignee
Assign to
Time tracking