Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: GSA_kwCzR0hTQS13M3E4LW00OTItNHB3cM4AA5Zd
Possibility to circumvent the invitation token expiry period
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. Wheninvite_for
is0
(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.
Permalink: https://github.com/advisories/GHSA-w3q8-m492-4pwpJSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS13M3E4LW00OTItNHB3cM4AA5Zd
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Moderate
Classification: General
Published: 11 months ago
Updated: 11 months ago
CVSS Score: 5.7
CVSS vector: CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N
EPSS Percentage: 0.00099
EPSS Percentile: 0.41995
Identifiers: GHSA-w3q8-m492-4pwp, CVE-2023-48220
References:
- https://github.com/decidim/decidim/security/advisories/GHSA-w3q8-m492-4pwp
- https://nvd.nist.gov/vuln/detail/CVE-2023-48220
- https://github.com/decidim/decidim/commit/073e60e2e4224dd81815a784002ebba30f2ebb34
- https://github.com/decidim/decidim/commit/b12800717a689c295a9ea680a38ca9f823d2c454
- https://github.com/scambra/devise_invitable/commit/94d859c7de0829bf63f679ae5dd3cab2b866a098
- https://github.com/decidim/decidim/blob/d2d390578050772d1bdb6d731395f1afc39dcbfc/decidim-core/config/initializers/devise.rb#L134
- https://github.com/decidim/decidim/releases/tag/v0.26.9
- https://github.com/decidim/decidim/releases/tag/v0.27.5
- https://github.com/decidim/decidim/releases/tag/v0.28.0
- https://github.com/scambra/devise_invitable/blob/41f58970ff76fb64382a9b9ea1bd530f7c3adab2/lib/devise_invitable/models.rb#L198
- https://github.com/advisories/GHSA-w3q8-m492-4pwp
Blast Radius: 19.6
Affected Packages
rubygems:decidim-system
Dependent packages: 2Dependent repositories: 311
Downloads: 295,041 total
Affected Version Ranges: >= 0.27.0, < 0.27.5, >= 0.0.1.alpha3, < 0.26.9
Fixed in: 0.27.5, 0.26.9
All affected versions: 0.0.1, 0.0.2, 0.0.3, 0.0.5, 0.0.6, 0.0.7, 0.1.0, 0.2.0, 0.3.0, 0.3.1, 0.3.2, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.5.0, 0.5.1, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.6.4, 0.6.5, 0.6.6, 0.6.7, 0.6.8, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.7.4, 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.10.0, 0.10.1, 0.11.1, 0.11.2, 0.12.0, 0.12.1, 0.12.2, 0.13.0, 0.13.1, 0.14.1, 0.14.2, 0.14.3, 0.14.4, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.17.0, 0.17.1, 0.17.2, 0.18.0, 0.18.1, 0.19.0, 0.19.1, 0.20.0, 0.20.1, 0.21.0, 0.22.0, 0.23.0, 0.23.1, 0.23.2, 0.23.3, 0.23.4, 0.23.5, 0.23.6, 0.24.0, 0.24.1, 0.24.2, 0.24.3, 0.25.0, 0.25.1, 0.25.2, 0.26.0, 0.26.1, 0.26.2, 0.26.3, 0.26.4, 0.26.5, 0.26.6, 0.26.7, 0.26.8, 0.27.0, 0.27.1, 0.27.2, 0.27.3, 0.27.4
All unaffected versions: 0.26.9, 0.26.10, 0.27.5, 0.27.6, 0.27.7, 0.27.8, 0.27.9, 0.28.0, 0.28.1, 0.28.2, 0.28.3, 0.28.4, 0.29.0, 0.29.1
rubygems:decidim-admin
Dependent packages: 43Dependent repositories: 311
Downloads: 300,596 total
Affected Version Ranges: >= 0.27.0, < 0.27.5, >= 0.0.1.alpha3, < 0.26.9
Fixed in: 0.27.5, 0.26.9
All affected versions: 0.0.1, 0.0.2, 0.0.3, 0.0.5, 0.0.6, 0.0.7, 0.1.0, 0.2.0, 0.3.0, 0.3.1, 0.3.2, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.5.0, 0.5.1, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.6.4, 0.6.5, 0.6.6, 0.6.7, 0.6.8, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.7.4, 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.10.0, 0.10.1, 0.11.1, 0.11.2, 0.12.0, 0.12.1, 0.12.2, 0.13.0, 0.13.1, 0.14.1, 0.14.2, 0.14.3, 0.14.4, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.17.0, 0.17.1, 0.17.2, 0.18.0, 0.18.1, 0.19.0, 0.19.1, 0.20.0, 0.20.1, 0.21.0, 0.22.0, 0.23.0, 0.23.1, 0.23.2, 0.23.3, 0.23.4, 0.23.5, 0.23.6, 0.24.0, 0.24.1, 0.24.2, 0.24.3, 0.25.0, 0.25.1, 0.25.2, 0.26.0, 0.26.1, 0.26.2, 0.26.3, 0.26.4, 0.26.5, 0.26.6, 0.26.7, 0.26.8, 0.27.0, 0.27.1, 0.27.2, 0.27.3, 0.27.4
All unaffected versions: 0.26.9, 0.26.10, 0.27.5, 0.27.6, 0.27.7, 0.27.8, 0.27.9, 0.28.0, 0.28.1, 0.28.2, 0.28.3, 0.28.4, 0.29.0, 0.29.1
rubygems:decidim
Dependent packages: 6Dependent repositories: 312
Downloads: 354,925 total
Affected Version Ranges: >= 0.27.0, < 0.27.5, >= 0.0.1.alpha3, < 0.26.9
Fixed in: 0.27.5, 0.26.9
All affected versions: 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.0.7, 0.1.0, 0.2.0, 0.3.0, 0.3.1, 0.3.2, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.5.0, 0.5.1, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.6.4, 0.6.5, 0.6.6, 0.6.7, 0.6.8, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.7.4, 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.10.0, 0.10.1, 0.11.1, 0.11.2, 0.12.0, 0.12.1, 0.12.2, 0.13.0, 0.13.1, 0.14.1, 0.14.2, 0.14.3, 0.14.4, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.17.0, 0.17.1, 0.17.2, 0.18.0, 0.18.1, 0.19.0, 0.19.1, 0.20.0, 0.20.1, 0.21.0, 0.22.0, 0.23.0, 0.23.1, 0.23.2, 0.23.3, 0.23.4, 0.23.5, 0.23.6, 0.24.0, 0.24.1, 0.24.2, 0.24.3, 0.25.0, 0.25.1, 0.25.2, 0.26.0, 0.26.1, 0.26.2, 0.26.3, 0.26.4, 0.26.5, 0.26.6, 0.26.7, 0.26.8, 0.27.0, 0.27.1, 0.27.2, 0.27.3, 0.27.4
All unaffected versions: 0.26.9, 0.26.10, 0.27.5, 0.27.6, 0.27.7, 0.27.8, 0.27.9, 0.28.0, 0.28.1, 0.28.2, 0.28.3, 0.28.4, 0.29.0, 0.29.1
rubygems:devise_invitable
Dependent packages: 23Dependent repositories: 2,790
Downloads: 31,407,338 total
Affected Version Ranges: >= 0.4.rc3, < 2.0.9
Fixed in: 2.0.9
All affected versions: 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.3.0, 0.3.1, 0.3.2, 0.3.4, 0.3.5, 0.3.6, 0.3.7, 0.4.0, 0.4.1, 0.4.2, 0.5.0, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.5.5, 0.5.6, 0.5.7, 0.6.0, 0.6.1, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.1.6, 1.1.7, 1.1.8, 1.2.1, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.5, 1.6.0, 1.6.1, 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.7.5, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.0.8
All unaffected versions: 2.0.9