-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"## The advisory tells you who is hostile\n\nThe CVE description, posted by Jarek Potiuk to oss-security on 2026-06-09, reads in full:\n\n> The Apache Airflow Samba provider's `GCSToSambaOperator` joined GCS object names to the SMB destination path without a containment check, so an object named with `../` segments resolved a write path outside the configured `destination_path`. An attacker able to write objects into the source GCS bucket, typically an external data producer distinct from the trusted DAG author, could write files to arbitrary locations on the Samba target when the operator ran.\n\nThat phrasing is more careful than a CVE record usually is. It encodes the operator's design surface in one sentence. The DAG author chooses the source bucket and the destination path. The entity that writes objects into the source bucket is, by the operator's own use case, somebody else. The whole point of a GCS-to-SMB transfer is to move data across an organizational boundary: from a producer who packages files into a bucket your team subscribes to, onto a Windows file share inside your network. The bucket's writers and the share's readers are separate populations by design.\n\nThat makes `source_object` an attacker-controlled string for any operator instance whose `source_bucket` accepts writes from anyone the DAG author does not directly employ. Which is most of them. Data exchange between organizations is what the operator exists for.\n\nThe variable's type signature is `source_object: str`. Read the name. The name implies \"a path under the bucket root that the trusted DAG author selected.\" The bytes are whatever a GCS bucket accepts as an object key. GCS accepts `../../etc/cron.d/runme`.\n\n## `os.path.join` is normalize, not sandbox\n\nPre-patch, the function read:\n\n```python\ndef _resolve_destination_path(self, source_object: str, prefix: str | None = None) -> str:\n if not self.keep_directory_structure:\n if prefix:\n source_object = os.path.relpath(source_object, start=prefix)\n else:\n source_object = os.path.basename(source_object)\n return os.path.join(self.destination_path, source_object)\n```\n\nThe variable name says `destination_path`. The function name says `_resolve_destination_path`. The body composes a base with a caller-supplied segment and returns the result. The pattern's name in our catalog is **Join Is Not Sandbox**: code reaches for `os.path.join`, `filepath.Join`, or `path.join` to compose a base directory with an untrusted segment, and reads the composition as a scoping primitive. The standard library defined that function as a normalizing primitive. The two behaviors disagree at exactly the inputs that matter.\n\n```\n>>> import os\n>>> os.path.join(\"media\", \"../../etc/cron.d/runme\")\n'media/../../etc/cron.d/runme'\n>>> os.path.normpath(_)\n'../etc/cron.d/runme'\n>>> os.path.join(\"media\", \"/etc/cron.d/runme\")\n'/etc/cron.d/runme'\n```\n\n`os.path.join` does not refuse `..` segments. It does not refuse absolute paths. Python's documentation states both behaviors, has stated them for two decades, and they are the documented behaviors. Sandboxing was never on offer. The operator never called `normpath`. The downstream `samba_hook.push_from_local(destination_path, ...)` does what an SMB client does with a write path: it opens it, walks the `..` segments at the protocol layer, writes there.\n\nThe structural mistake is reading the name of the standard-library helper as the contract. The helper joins two strings into a path string. The contract the developer believed was \"scope the second argument under the first.\" That contract requires a second call. The function as written never made it.\n\n## The patch added the line the standard library does not provide\n\nThe PR #67857 diff, in full:\n\n```diff\n- return os.path.join(self.destination_path, source_object)\n+ # Source object names come from the GCS bucket and may contain \"..\" segments.\n+ # Normalize the joined path and make sure it stays within destination_path so a\n+ # crafted object name cannot resolve a write target outside the configured directory.\n+ resolved = os.path.normpath(os.path.join(self.destination_path, source_object))\n+ base = os.path.normpath(self.destination_path)\n+ if resolved != base and not resolved.startswith(base + os.sep):\n+ raise ValueError(\n+ f\"Resolved destination path {resolved!r} is outside the configured \"\n+ f\"destination_path {base!r}; refusing to write outside it.\"\n+ )\n+ return resolved\n```\n\n`os.path.normpath` collapses `..` segments into the absolute or relative form the filesystem will actually act on. The `startswith(base + os.sep)` prefix check is the standard Python idiom for \"this resolved path is contained under this base.\" Together they are the post-join verification the pattern's name demands. The patch is correct, narrow, and tested.\n\nThe committed test parameterization in `providers/samba/tests/unit/samba/transfers/test_gcs_to_samba.py` reads:\n\n```python\n@pytest.mark.parametrize(\n \"source_object\",\n [\n \"../../victim_area/payload\",\n \"../escape\",\n \"subdir/../../escape\",\n ],\n)\ndef test_resolve_destination_path_rejects_traversal(self, source_object):\n ...\n with pytest.raises(ValueError, match=\"outside the configured\"):\n operator._resolve_destination_path(source_object)\n```\n\nThe test's `parametrize` list is also the reproducer for any operator running a pre-4.12.6 Samba provider against an attacker-writable bucket. One of those object names, dropped into the source bucket the DAG points at, lands the corresponding file under the SMB share's traversal of `destination_path` on the next operator run.\n\nA small accuracy note: the oss-security advisory describes the fix as raising `AirflowException`. The shipped commit raises `ValueError`. The caller's experience is identical: the task fails before any SMB write.\n\n## The sibling operator was not patched\n\nThe Samba provider was not the original. The Airflow operator pattern for \"copy a GCS object onto a remote filesystem\" was first implemented for SFTP, in the Google provider's `providers/google/cloud/transfers/gcs_to_sftp.py`. The Samba operator is a near-line-for-line copy of that file, with the `SFTPHook` swapped for `SambaHook`. The function names, the constructor arguments, the docstring example, the wildcard handling, the `_resolve_destination_path` and `_copy_single_object` methods all derive from the SFTP version. `diff` between the two files reports differences in the module docstring, the class name, the connection-id default, and the addition of a `buffer_size` parameter. The path-handling logic is identical.\n\nThe current state of `apache/airflow` main, as of 2026-06-15:\n\n```python\ndef _resolve_destination_path(self, source_object: str, prefix: str | None = None) -> str:\n if not self.keep_directory_structure:\n if prefix:\n source_object = os.path.relpath(source_object, start=prefix)\n else:\n source_object = os.path.basename(source_object)\n return os.path.join(self.destination_path, source_object)\n```\n\nThat is `GCSToSFTPOperator._resolve_destination_path` at lines 173 through 179 of `gcs_to_sftp.py`. Same function name as the patched Samba function. Same conditional rewrite of `source_object`. Same final return. The diff between this function and the pre-patch `GCSToSambaOperator._resolve_destination_path` is zero useful lines.\n\nA search of `apache/airflow` open and closed pull requests for `gcs_to_sftp` plus `path traversal` returns nothing. There is no fix in flight for the sibling. The Samba CVE was published 2026-06-09. The Samba PR landed 2026-06-02. Today is 2026-06-15. The function still returns the join.\n\nThe same DAG, swapping `GCSToSambaOperator` for `GCSToSFTPOperator`, exhibits the same primitive against a different protocol. An object named `../../etc/cron.d/runme` in the source bucket lands, after the operator's `_copy_single_object` calls `sftp_hook.store_file(destination_path, ...)`, at the resolved path the SFTP server walks the same way the SMB server walked it: by following the segments. The Google provider is the most-installed Airflow provider in the ecosystem. The SFTP operator is one of its data-egress workhorses. The fix authored for one file applies, with the variable name `samba` replaced by `sftp`, to the other.\n\n`GCSToSambaOperator` was patched. `GCSToSFTPOperator` in the same repository still returns `os.path.join(self.destination_path, source_object)`.\n\n## The fourth exhibit on Join Is Not Sandbox\n\nThe pattern's prior exhibits in our catalog are:\n\n- Casdoor's Go function `LocalFileSystemProvider.GetFullPath`, where `filepath.Join(BaseDir, path)` plus `filepath.Abs` was read as a sandbox.\n- DbGate's Node function `unzipDirectory`, where `path.join(outputDirectory, entry.fileName)` was trusted to scope writes inside an extracted archive.\n- NASA AIT-Core's Python function `_get_log_file`, where `os.path.join(handler[\"log_dir\"], handler[\"path\"], filename)` exposed Python's absolute-path-overwrite behavior to a REST API.\n\nCVE-2026-49818 is the fourth exhibit, and the second Python case. The first Python exhibit hit the absolute-path-overwrite variant: when the caller controls an argument that starts with `/`, `os.path.join` discards every prior argument. This case hits the `..` segment variant: when the caller controls an argument whose `..` segments walk past the base, `os.path.normpath` of the join walks past the base too. Both behaviors are documented. Both are sandbox-breaking for code that omitted the post-join verification. Both keep recurring in code authored by experienced maintainers in well-reviewed codebases.\n\nThe patches across the four exhibits converge on the same shape: normalize the join, then check that the result is the base or starts with the base plus separator. The standard libraries do not export that combined primitive. Every codebase that wants the sandbox writes the same four lines, and every codebase that doesn't is one CVE away from writing them.","closing_line":"Apache patched the operator that was reported. The sibling that was not reported still ships the line.","hook_md":"Apache published an oss-security advisory for the Airflow Samba provider on 2026-06-09. The vulnerable function, `GCSToSambaOperator._resolve_destination_path`, ended with `return os.path.join(self.destination_path, source_object)`. The fix at PR #67857 added `os.path.normpath` and a `startswith(base + os.sep)` prefix check, the actual sandbox primitive Python's `os.path.join` is not. Six days later, in the same Apache Airflow repository, `GCSToSFTPOperator._resolve_destination_path` at line 179 of `gcs_to_sftp.py` still returns `os.path.join(self.destination_path, source_object)`. Same function name. Same line. Same trust shape. CVE-2026-49818 closed the operator the researcher named.","post_id":631,"slug":"airflow-cve-2026-49818-the-sftp-sibling-still-joins","title":"CVE-2026-49818: Apache Patched The Samba Operator. The SFTP Sibling Still Calls os.path.join.","type":"initial","unreadable_sentence":"`GCSToSambaOperator` was patched. `GCSToSFTPOperator` in the same repository still returns `os.path.join(self.destination_path, source_object)`."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCat5XAgAKCRDeZjl4jgkQ JjFRAPwIDvNYey4M7GgjT3b8DFKkR3KQXhp+UQyGb3WSIO7UxwD/Q+gvQHC6JYf4 t1HxvzjHwj4VrfYVU9SA6vwVSXsFvgI= =S4sG -----END PGP SIGNATURE-----