Vulnerabilities in pkg:gem/devise_invitable

PACKAGE
Advisory Identifier: GHSA-w3q8-m492-4pwp
Advisory Summary

CVE-2023-48220 is a MODERATE (CVSS 5.7) possibility to circumvent the invitation vulnerability (CWE-672: Operation on a Resource after Expiration or Release) affecting Decidim libraries in the RubyGems ecosystem. The issue involves possibility to circumvent the invitation token expiry period. Remediation is available by upgrading affected packages to version 0.26.9, 2.0.9, 0.27.5.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:gem/devise_invitable

2 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:gem/devise_invitable. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-w3q8-m492-4pwp CVE-2023-48220 MODERATE Possibility to circumvent the invitation token expiry period
GHSA-wj5j-xpcj-45gc - MODERATE Cross-Site Request Forgery (CSRF)

CVE-2023-48220 at a Glance

CVE Identifier CVE-2023-48220
GHSA Identifier GHSA-w3q8-m492-4pwp
Severity MODERATE
CVSS v3.1 Base Score 5.7
CWE Classification CWE-672: Operation on a Resource after Expiration or Release
Affected Product Decidim
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 5.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required High (PR:H)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2023-48220

To remediate this vulnerability, upgrade all affected Decidim dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

decidim fixed: 0.26.9
Upgrade decidim to 0.26.9
decidim-admin fixed: 0.26.9
Upgrade decidim-admin to 0.26.9
decidim-system fixed: 0.26.9
Upgrade decidim-system to 0.26.9
devise_invitable fixed: 2.0.9
Upgrade devise_invitable to 2.0.9
decidim fixed: 0.27.5
Upgrade decidim to 0.27.5
decidim-admin fixed: 0.27.5
Upgrade decidim-admin to 0.27.5
decidim-system fixed: 0.27.5
Upgrade decidim-system to 0.27.5
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for decidim

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-48220, inspect your project dependencies for Decidim:

inspect dependencies for decidim

Analyze the terminal output to locate any version of Decidim in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.26.9), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-672: Operation on a Resource after Expiration or Release, where the product uses, accesses, or otherwise operates on a resource after that resource has been expired, released, or revoked. In Decidim, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact The invites feature allows users to accept the invitation for an unlimited amount of time through the password reset functionality. When using the password reset functionality, the `devise_invitable` gem always accepts the pending invitation if the user has been invited as shown in this piece of code within the `devise_invitable` gem: https://github.com/scambra/devise_invitable/blob/41f58970ff76fb64382a9b9ea1bd530f7c3adab2/lib/devise_invitable/models.rb#L198 The only check done here is if the user has been invited but the code does not ensure that the pending invitation is still valid as defined by the `invite_for` expiry period as explained in the gem's documentation: https://github.com/scambra/devise_invitable#model-configuration- > `invite_for`: The period the generated invitation token is valid. After this period, the invited resource won’t be able to accept the invitation. When `invite_for` is `0` (the default), the invitation won’t expire. Decidim sets this configuration to `2.weeks` so this configuration should be respected: https://github.com/decidim/decidim/blob/d2d390578050772d1bdb6d731395f1afc39dcbfc/decidim-core/config/initializers/devise.rb#L134 The bug is in the `devise_invitable` gem and should be fixed there and the dependency should be upgraded in Decidim once the fix becomes available. ### Patches Update `devise_invitable` to version `2.0.9` or above by running the following command: ``` $ bundle update devise_invitable ``` ### Workarounds The invitations can be cancelled directly from the database by running the following command from the Rails console: ``` > Decidim::User.invitation_not_accepted.update_all(invitation_token: nil) ``` ### References OWASP ASVS V4.0.3-2.3.1 This bug has existed in the `devise_invitable` gem since this commit which was first included in the `v0.4.rc3` release of this gem: https://github.com/scambra/devise_invitable/commit/94d859c7de0829bf63f679ae5dd3cab2b866a098 All versions since then are affected. This gem was first introduced at its version `~> 1.7.0` to the `decidim-admin` gem in this commit which was first included in the `v0.0.1.alpha3` release of Decidim: https://github.com/decidim/decidim/commit/073e60e2e4224dd81815a784002ebba30f2ebb34 It was first introduced at its version `~> 1.7.0` to the `decidim-system` gem in this commit which was also first included in the `v0.0.1.alpha3` release of Decidim: https://github.com/decidim/decidim/commit/b12800717a689c295a9ea680a38ca9f823d2c454 ### Credits This issue was discovered in City of Helsinki's security audit against Decidim 0.27 done during September 2023. The security audit was implemented by [Deloitte Finland](https://www2.deloitte.com/fi/fi.html).

CVE-2023-48220 Affected Decidim Versions

7 component(s)
Fixed Versions:
0.26.92.0.90.27.5
Product / Package Ecosystem Affected Versions Fixed Version
decidim
RubyGems
≥ 0.0.1.alpha3
< 0.26.9
0.26.9
decidim-admin
RubyGems
≥ 0.0.1.alpha3
< 0.26.9
0.26.9
decidim-system
RubyGems
≥ 0.0.1.alpha3
< 0.26.9
0.26.9
devise_invitable
RubyGems
≥ 0.4.rc3
< 2.0.9
2.0.9
decidim
RubyGems
≥ 0.27.0
< 0.27.5
0.27.5
decidim-admin
RubyGems
≥ 0.27.0
< 0.27.5
0.27.5
decidim-system
RubyGems
≥ 0.27.0
< 0.27.5
0.27.5

References

Frequently Asked Questions

What is CVE-2023-48220?
CVE-2023-48220 is a security vulnerability in Decidim involving Possibility to circumvent the invitation token expiry period under CWE-672: Operation on a Resource after Expiration or Release.
Which Decidim versions are affected?
Affected versions include releases prior to 0.26.9, 2.0.9, 0.27.5 across affected packages: decidim, decidim-admin, decidim-system, devise_invitable.
What version fixes CVE-2023-48220?
Upgrading to 0.26.9, 2.0.9, 0.27.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is decidim affected?
Yes, decidim is affected in releases prior to 0.26.9, 0.27.5. Upgrade your dependency to 0.26.9, 0.27.5 or later.
Is decidim-admin affected?
Yes, decidim-admin is affected in releases prior to 0.26.9, 0.27.5. Upgrade your dependency to 0.26.9, 0.27.5 or later.
What is the CVSS score of CVE-2023-48220?
CVE-2023-48220 has a CVSS v3.1 base score of 5.7 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2023-48220?
CVE-2023-48220 is classified under CWE-672: Operation on a Resource after Expiration or Release (The product uses, accesses, or otherwise operates on a resource after that resource has been expired, released, or revoked.).
How can I check RubyGems dependencies for CVE-2023-48220?
Run the dependency tree command: 'inspect dependencies for decidim'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-w3q8-m492-4pwp",
  "modified" : "2024-02-20T19:26:51Z",
  "published" : "2024-02-20T19:26:51Z",
  "aliases" : [ "CVE-2023-48220" ],
  "summary" : "Possibility to circumvent the invitation token expiry period",
  "details" : "### Impact\nThe invites feature allows users to accept the invitation for an unlimited amount of time through the password reset functionality.\n\nWhen using the password reset functionality, the `devise_invitable` gem always accepts the pending invitation if the user has been invited as shown in this piece of code within the `devise_invitable` gem:\nhttps://github.com/scambra/devise_invitable/blob/41f58970ff76fb64382a9b9ea1bd530f7c3adab2/lib/devise_invitable/models.rb#L198\n\nThe only check done here is if the user has been invited but the code does not ensure that the pending invitation is still valid as defined by the `invite_for` expiry period as explained in the gem's documentation:\nhttps://github.com/scambra/devise_invitable#model-configuration-\n\n> `invite_for`: The period the generated invitation token is valid. After this period, the invited resource won’t be able to accept the invitation. When `invite_for` is `0` (the default), the invitation won’t expire.\n\nDecidim sets this configuration to `2.weeks` so this configuration should be respected:\nhttps://github.com/decidim/decidim/blob/d2d390578050772d1bdb6d731395f1afc39dcbfc/decidim-core/config/initializers/devise.rb#L134\n\nThe bug is in the `devise_invitable` gem and should be fixed there and the dependency should be upgraded in Decidim once the fix becomes available.\n\n### Patches\nUpdate `devise_invitable` to version `2.0.9` or above by running the following command:\n\n```\n$ bundle update devise_invitable\n```\n\n### Workarounds\nThe invitations can be cancelled directly from the database by running the following command from the Rails console:\n\n```\n> Decidim::User.invitation_not_accepted.update_all(invitation_token: nil)\n```\n\n### References\nOWASP ASVS V4.0.3-2.3.1\n\nThis bug has existed in the `devise_invitable` gem since this commit which was first included in the `v0.4.rc3` release of this gem:\nhttps://github.com/scambra/devise_invitable/commit/94d859c7de0829bf63f679ae5dd3cab2b866a098\n\nAll versions since then are affected.\n\nThis gem was first introduced at its version `~> 1.7.0` to the `decidim-admin` gem in this commit which was first included in the `v0.0.1.alpha3` release of Decidim:\nhttps://github.com/decidim/decidim/commit/073e60e2e4224dd81815a784002ebba30f2ebb34\n\nIt was first introduced at its version `~> 1.7.0` to the `decidim-system` gem in this commit which was also first included in the `v0.0.1.alpha3` release of Decidim:\nhttps://github.com/decidim/decidim/commit/b12800717a689c295a9ea680a38ca9f823d2c454\n\n### Credits\nThis issue was discovered in City of Helsinki's security audit against Decidim 0.27 done during September 2023. The security audit was implemented by [Deloitte Finland](https://www2.deloitte.com/fi/fi.html).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "decidim"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.0.1.alpha3"
      }, {
        "fixed" : "0.26.9"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "decidim-admin"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.0.1.alpha3"
      }, {
        "fixed" : "0.26.9"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "decidim-system"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.0.1.alpha3"
      }, {
        "fixed" : "0.26.9"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "devise_invitable"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.4.rc3"
      }, {
        "fixed" : "2.0.9"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "decidim"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.27.0"
      }, {
        "fixed" : "0.27.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "decidim-admin"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.27.0"
      }, {
        "fixed" : "0.27.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "decidim-system"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.27.0"
      }, {
        "fixed" : "0.27.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/decidim/decidim/security/advisories/GHSA-w3q8-m492-4pwp"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-48220"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/decidim/decidim/commit/073e60e2e4224dd81815a784002ebba30f2ebb34"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/decidim/decidim/commit/b12800717a689c295a9ea680a38ca9f823d2c454"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/scambra/devise_invitable/commit/94d859c7de0829bf63f679ae5dd3cab2b866a098"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/decidim/decidim"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/decidim/decidim/blob/d2d390578050772d1bdb6d731395f1afc39dcbfc/decidim-core/config/initializers/devise.rb#L134"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/decidim/decidim/releases/tag/v0.26.9"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/decidim/decidim/releases/tag/v0.27.5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/decidim/decidim/releases/tag/v0.28.0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/scambra/devise_invitable/blob/41f58970ff76fb64382a9b9ea1bd530f7c3adab2/lib/devise_invitable/models.rb#L198"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-672" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-02-20T19:26:51Z",
    "nvd_published_at" : "2024-02-20T18:15:50Z"
  }
}