Gradle vulnerable to local privilege escalation through system temporary directory
Gradle is a build automation tool, and its native-platform tool provides Java bindings for native APIs. On Unix-like systems, the system temporary directory can be created with open permissions that allow multiple users to create and delete files within it. This library initialization could be vulnerable to a local privilege escalation from an attacker quickly deleting and recreating files in the system temporary directory. Gradle builds that rely on versions of net.rubygrapefruit:native-platform prior to 0.22-milestone-28 could be vulnerable to a local privilege escalation from an attacker quickly deleting and recreating files in the system temporary directory. In net.rubygrapefruit:native-platform prior to version 0.22-milestone-28, if the `Native.get(Class<>)` method was called, without calling `Native.init(File)` first, with a non-`null` argument used as working file path, then the library would initialize itself using the system temporary directory and NativeLibraryLocator.java lines 68 through 78. Version 0.22-milestone-28 has been released with changes that fix the problem. Initialization is now mandatory and no longer uses the system temporary directory, unless such a path is passed for initialization. The only workaround for affected versions is to make sure to do a proper initialization, using a location that is safe. Gradle 8.12, only that exact version, had codepaths where the initialization of the underlying native integration library took a default path, relying
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2025-27148
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 3 Nov 2026, 10:53 UTC · Revision 1
Source evidence
Gradle vulnerable to local privilege escalation through system temporary directory
core-osv · Original sourcePublished 25 Feb 2025, 20:13 UTC
Gradle is a build automation tool, and its native-platform tool provides Java bindings for native APIs. On Unix-like systems, the system temporary directory can be created with open permissions that allow multiple users to create and delete files within it. This library initialization could be vulnerable to a local privilege escalation from an attacker quickly deleting and recreating files in the system temporary directory. Gradle builds that rely on versions of net.rubygrapefruit:native-platform prior to 0.22-milestone-28 could be vulnerable to a local privilege escalation from an attacker quickly deleting and recreating files in the system temporary directory. In net.rubygrapefruit:native-platform prior to version 0.22-milestone-28, if the `Native.get(Class<>)` method was called, without calling `Native.init(File)` first, with a non-`null` argument used as working file path, then the library would initialize itself using the system temporary directory and NativeLibraryLocator.java lines 68 through 78. Version 0.22-milestone-28 has been released with changes that fix the problem. Initialization is now mandatory and no longer uses the system temporary directory, unless such a path is passed for initialization. The only workaround for affected versions is to make sure to do a proper initialization, using a location that is safe. Gradle 8.12, only that exact version, had codepaths where the initialization of the underlying native integration library took a default path, relying
osv:CVE-2025-27148
Complete source record
{
"id": "45294c3f8419d5685b80f1fd6b63e70a6942b7dbcb9e461b687d489682ba4794",
"url": "https://osv.dev/vulnerability/CVE-2025-27148",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "Gradle vulnerable to local privilege escalation through system temporary directory",
"summary": "Gradle is a build automation tool, and its native-platform tool provides Java bindings for native APIs. On Unix-like systems, the system temporary directory can be created with open permissions that allow multiple users to create and delete files within it. This library initialization could be vulnerable to a local privilege escalation from an attacker quickly deleting and recreating files in the system temporary directory. Gradle builds that rely on versions of net.rubygrapefruit:native-platform prior to 0.22-milestone-28 could be vulnerable to a local privilege escalation from an attacker quickly deleting and recreating files in the system temporary directory. In net.rubygrapefruit:native-platform prior to version 0.22-milestone-28, if the `Native.get(Class<>)` method was called, without calling `Native.init(File)` first, with a non-`null` argument used as working file path, then the library would initialize itself using the system temporary directory and NativeLibraryLocator.java lines 68 through 78. Version 0.22-milestone-28 has been released with changes that fix the problem. Initialization is now mandatory and no longer uses the system temporary directory, unless such a path is passed for initialization. The only workaround for affected versions is to make sure to do a proper initialization, using a location that is safe. Gradle 8.12, only that exact version, had codepaths where the initialization of the underlying native integration library took a default path, relying",
"evidence": "osv:CVE-2025-27148",
"products": [],
"severity": "high",
"structured": {
"id": "CVE-2025-27148",
"aliases": [
"BIT-gradle-2025-27148",
"CVE-2025-27148"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/gradle/gradle",
"type": "GIT",
"events": [
{
"introduced": "a3cacb207fec727859be9354c1937da2e59004c1"
},
{
"last_affected": "a3cacb207fec727859be9354c1937da2e59004c1"
}
],
"database_specific": {
"extracted_events": [
{
"range": [
{
"introduced": "= 8.12"
},
{
"last_affected": "= 8.12"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StandaloneSingleVersion"
}
]
}
},
{
"repo": "https://github.com/gradle/native-platform",
"type": "GIT",
"events": [
{
"introduced": "0"
},
{
"fixed": "87f4647e90db6006bf357db0ba7fa29925dcc32e"
}
],
"database_specific": {
"extracted_events": [
{
"range": [
{
"introduced": "0"
},
{
"fixed": "0.22-milestone-28"
}
],
"source": "DESCRIPTION"
}
]
}
}
],
"versions": [
"= 8.12",
"v8.12.0",
"0.22-milestone-27",
"0.22-milestone-26",
"0.22-milestone-25",
"0.22-milestone-24",
"0.22-milestone-23",
"0.22-milestone-22",
"0.22-milestone-21",
"0.22-milestone-20",
"0.22-milestone-19",
"0.22-milestone-18",
"0.22-milestone-17",
"0.22-milestone-13",
"0.22-milestone-12",
"0.22-milestone-11",
"0.22-milestone-10",
"0.22-milestone-9",
"0.22-milestone-8",
"0.22-milestone-6",
"0.22-milestone-5",
"0.22-milestone-4",
"0.22-milestone-3",
"0.22-milestone-2",
"0.22-milestone-1",
"0.22-alpha-1",
"0.21",
"0.20",
"0.19",
"0.18",
"0.17",
"0.16",
"0.15",
"0.14",
"0.13",
"0.12",
"0.11",
"0.10",
"0.9",
"0.8",
"0.7",
"0.6",
"0.5",
"0.4",
"0.3-rc-2",
"0.3-rc-1",
"0.2",
"0.1"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-27148.json"
}
}
],
"modified": "2026-10-28T02:30:28.342430889Z",
"provider": "osv",
"references": [
"https://en.wikipedia.org/wiki/Fstab#Options_common_to_all_filesystems",
"https://en.wikipedia.org/wiki/Sticky_bit",
"https://github.com/gradle/native-platform/blob/574dfe8d9fb546c990436468d617ab81c140871d/native-platform/src/main/java/net/rubygrapefruit/platform/internal/NativeLibraryLocator.java#L68-L78",
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/27xxx/CVE-2025-27148.json",
"https://github.com/gradle/gradle/security/advisories/GHSA-465q-w4mf-4f4r",
"https://github.com/gradle/gradle/security/advisories/GHSA-89qm-pxvm-p336",
"https://github.com/gradle/native-platform/security/advisories/GHSA-2xxp-vw2f-p3x8",
"https://nvd.nist.gov/vuln/detail/CVE-2025-27148",
"https://github.com/gradle/gradle/pull/32025",
"https://github.com/gradle/native-platform/pull/353"
],
"provider_metadata": {
"cwe_ids": [
"CWE-378",
"CWE-379"
],
"cna_assigner": "GitHub_M",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/27xxx/CVE-2025-27148.json"
}
},
"related_cves": [
{
"value": "CVE-2025-27148",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 494733,
"published_at": "2025-02-25T20:13:51.578+00:00"
}