Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: GSA_kwCzR0hTQS1oZjU5LTdyd3EtNzg1bc4ABAmD
In AshPostgres, empty, atomic, non-bulk actions, policy bypass for side-effects vulnerability.
Impact
What kind of vulnerability is it? Who is impacted?
In certain very specific situations, it was possible for the policies of an update action to be skipped. This occurred only on "empty" update actions (no changing fields), and would allow their hooks (side effects) to be performed when they should not have been. Note that this does not allow reading new data that the user should not have had access to, only triggering a side effect a user should not have been able to trigger.
You must have an update action that:
- Is on a resource with no attributes containing an "update default" (updated_at timestamp, for example)
- can be performed atomically.
- Does not have
require_atomic? false
- Has at least one authorizer (typically
Ash.Policy.Authorizer
) - Has at least one
change
(on the resource'schanges
block or in the action itself)
This is where the side-effects would be performed when they should not have been.
- Is there ever a place where you call this action manually, using
Ash.update
.
Note that AshGraphql and AshJsonApi action calls are not affected as they useAsh.bulk_update
. - If so, is there ever a case where you call the action with zero inputs, and have it produce zero changing fields.
- If so, could it then produce a side effect. This means you'd have an after_action hook that calls some other resource.
- If so, does that side effect bypass another resource's policies, i.e using
authorize?: false
, or not providing the same actor.
Everything above the line can be checked with the provided script. Everything below it, must be checked manually. The script for checking this is available in the "Might I be affected" section.
The script can have false positives, but will not have any false negatives. So if you run the script, and it says "No potential vulnerabilities found", then all you need to do is update ash_postgres.
Patches
This problem has been patched in 2.4.10
of ash_postgres
.
Workarounds
You could:
- Determine that none of your actions are vulnerable using the script.
- Add
require_atomic? false
to any potentially affected update action - Replace any usage of
Ash.update
withAsh.bulk_update
for an affected action - add an update timestamp to your action.
Might I be affected
This gist provides a script you can run to detect if you are potentially vulnerable.
https://gist.github.com/zachdaniel/e49166b765978c48dfaf998d06df436e
References
Original Report/discovery: https://elixirforum.com/t/empty-update-action-with-policies/66954
Fix commit: https://github.com/ash-project/ash_postgres/commit/1228fcd851f29a68609e236f7d6a2622a4b5c4ba
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1oZjU5LTdyd3EtNzg1bc4ABAmD
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Moderate
Classification: General
Published: 14 days ago
Updated: 14 days ago
CVSS Score: 5.3
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
Identifiers: GHSA-hf59-7rwq-785m, CVE-2024-49756
References:
- https://github.com/ash-project/ash_postgres/security/advisories/GHSA-hf59-7rwq-785m
- https://github.com/ash-project/ash_postgres/commit/1228fcd851f29a68609e236f7d6a2622a4b5c4ba
- https://elixirforum.com/t/empty-update-action-with-policies/66954
- https://gist.github.com/zachdaniel/e49166b765978c48dfaf998d06df436e
- https://nvd.nist.gov/vuln/detail/CVE-2024-49756
- https://github.com/advisories/GHSA-hf59-7rwq-785m
Blast Radius: 6.7
Affected Packages
hex:ash_postgres
Dependent packages: 4Dependent repositories: 18
Downloads: 324,685 total
Affected Version Ranges: >= 2.0.0, < 2.4.10
Fixed in: 2.4.10
All affected versions: 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, 2.0.9, 2.0.10, 2.0.11, 2.0.12, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 2.1.6, 2.1.8, 2.1.9, 2.1.10, 2.1.11, 2.1.12, 2.1.13, 2.1.14, 2.1.15, 2.1.17, 2.1.18, 2.1.19, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.2.4, 2.2.5, 2.3.0, 2.3.1, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8, 2.4.9
All unaffected versions: 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.2.0, 0.2.1, 0.3.0, 0.4.0, 0.5.0, 0.6.0, 0.7.0, 0.8.0, 0.9.0, 0.10.0, 0.11.2, 0.12.0, 0.12.1, 0.13.0, 0.14.0, 0.15.0, 0.16.1, 0.17.0, 0.18.0, 0.19.0, 0.20.0, 0.20.1, 0.21.0, 0.22.0, 0.22.1, 0.23.0, 0.23.1, 0.23.2, 0.24.0, 0.25.0, 0.25.1, 0.25.2, 0.25.3, 0.25.4, 0.25.5, 0.26.0, 0.26.1, 0.26.2, 0.27.0, 0.28.0, 0.28.1, 0.29.1, 0.29.2, 0.29.3, 0.29.4, 0.29.5, 0.29.6, 0.30.1, 0.31.1, 0.32.0, 0.32.1, 0.32.2, 0.33.0, 0.33.1, 0.34.0, 0.34.1, 0.34.2, 0.34.3, 0.34.4, 0.34.5, 0.35.1, 0.35.3, 0.35.4, 0.35.5, 0.36.0, 0.36.1, 0.36.2, 0.36.3, 0.36.4, 0.36.5, 0.37.0, 0.37.1, 0.37.2, 0.37.3, 0.37.4, 0.37.5, 0.37.6, 0.37.7, 0.37.8, 0.38.0, 0.38.1, 0.38.2, 0.38.3, 0.38.4, 0.38.5, 0.38.6, 0.38.7, 0.38.8, 0.38.9, 0.38.10, 0.38.11, 0.40.1, 0.40.2, 0.40.3, 0.40.4, 0.40.5, 0.40.6, 0.40.7, 0.40.8, 0.40.9, 0.40.10, 0.40.11, 0.41.1, 0.41.2, 0.41.3, 0.41.4, 0.41.5, 0.41.6, 0.41.7, 0.43.0, 1.0.0, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.2.6, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.8, 1.3.9, 1.3.10, 1.3.11, 1.3.12, 1.3.14, 1.3.15, 1.3.16, 1.3.17, 1.3.18, 1.3.19, 1.3.20, 1.3.21, 1.3.22, 1.3.23, 1.3.24, 1.3.25, 1.3.26, 1.3.28, 1.3.29, 1.3.30, 1.3.31, 1.3.32, 1.3.33, 1.3.34, 1.3.35, 1.3.36, 1.3.37, 1.3.38, 1.3.39, 1.3.40, 1.3.41, 1.3.42, 1.3.43, 1.3.44, 1.3.45, 1.3.46, 1.3.47, 1.3.48, 1.3.49, 1.3.50, 1.3.51, 1.3.52, 1.3.53, 1.3.54, 1.3.55, 1.3.56, 1.3.58, 1.3.59, 1.3.60, 1.3.61, 1.3.62, 1.3.63, 1.3.64, 1.3.65, 1.3.66, 1.3.67, 1.3.68, 1.4.0, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.5.10, 1.5.11, 1.5.12, 1.5.13, 1.5.14, 1.5.15, 1.5.16, 1.5.17, 1.5.18, 1.5.19, 1.5.20, 1.5.21, 1.5.22, 1.5.23, 1.5.24, 1.5.25, 1.5.26, 1.5.27, 1.5.28, 1.5.29, 1.5.30, 2.4.10, 2.4.11, 2.4.12