Skip to content

Commit d5f069f

Browse files
yeshsuryaYeshwanth NagarajCopilot
authored
Week 21: fix 18 Rust vulns in rattler.abi3.so across 4 ACFT images (#5079)
All four images shipped a py-rattler conda solver backend whose compiled /opt/conda/lib/python3.13/site-packages/rattler/rattler.abi3.so bundled vulnerable Rust crates (5 CRITICAL + 5 HIGH + 8 MEDIUM): - openssl 0.10.75 -> 0.10.78 (CVE-2026-41676/41677/41678/41681/41898) - aws-lc-sys 0.37.1 -> 0.38.0/0.39.0 (GHSA-65p9/hfpc/vw5v/394x/9f94) - bytes 1.11.0 -> 1.11.1 (CVE-2026-25541) - tar 0.4.44 -> 0.4.45 (CVE-2026-33055/33056) - rustls-webpki 0.103.9 -> 0.103.13 (GHSA-pwjx/965h/xgp8/82j2) - rand 0.8.5+0.9.2 -> 0.8.6+0.9.3 (GHSA-cq8v) Fix: remove py-rattler + conda-rattler-solver from base env (conda solver falls back to libmamba/classic; rattler is not used at training runtime). For acft-hf-nlp-gpu: removal must happen AFTER the later 'conda install pip' step which otherwise re-pulls py-rattler from env consistency checks; also clean stale conda-meta/py-rattler-*.json. For acpt-draft: base image biweekly.202605.2 already dropped py-rattler; instead applied pip>=26.1 + urllib3>=2.7.0 fixes for unrelated findings (CVE-2026-6357 pip, CVE-2026-44431/44432 urllib3) + cleaned stale conda-meta. All four images vcm-validated clean (0 critical / 0 high / 0 medium). Co-authored-by: Yeshwanth Nagaraj <ynagaraj@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4c8bfba commit d5f069f

4 files changed

Lines changed: 96 additions & 57 deletions

File tree

  • assets/training
    • finetune_acft_hf_nlp/environments
    • finetune_acft_image/environments
      • acft_image_medimageinsight_adapter_finetune/context
      • acft_image_mmdetection/context

assets/training/finetune_acft_hf_nlp/environments/acpt-draft/context/Dockerfile

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,6 @@
22
FROM mcr.microsoft.com/aifx/acpt/stable-ubuntu2204-cu126-py310-torch280:{{latest-image-tag:biweekly\.\d{6}\.\d{1}.*}}
33
USER root
44

5-
# USN-8227-1 (curl/libcurl4/libcurl3-gnutls), USN-8233-1 (libnghttp2-14),
6-
# USN-8251-1 (libpng16-16), USN-8229-1 (sed): Ubuntu 22.04 system packages
7-
# installed in the base image. The base image tag already pins to the latest
8-
# biweekly build, but it has not yet picked up these jammy-security updates.
9-
# Direct apt upgrade is the only fix path.
10-
RUN apt-get -y update && apt-get -y upgrade && \
11-
apt-get clean && rm -rf /var/lib/apt/lists/*
12-
13-
# GHSA-jp4c-xjxw-mgf9 (CVE-2026-6357): pip<26.1 self-update vulnerability.
14-
# pip has no parent package — it is shipped directly by the base image in both
15-
# conda envs (base: python3.13 / ptca: python3.10), so we upgrade both via
16-
# conda-forge and remove the leftover dist-info / conda-meta entries from the
17-
# old 26.0.1 so the SBOM scanner does not double-detect the vulnerable version.
18-
RUN conda install -y -n base -c conda-forge pip==26.1.1 && \
19-
conda install -y -n ptca -c conda-forge pip==26.1.1 && \
20-
rm -rf /opt/conda/lib/python3.13/site-packages/pip-26.0*.dist-info && \
21-
rm -f /opt/conda/conda-meta/pip-26.0*.json && \
22-
rm -rf /opt/conda/envs/ptca/lib/python3.10/site-packages/pip-26.0*.dist-info && \
23-
rm -f /opt/conda/envs/ptca/conda-meta/pip-26.0*.json && \
24-
conda clean -ay
25-
26-
# GHSA-qccp-gfcp-xxvc (CVE-2026-44431), GHSA-mf9v-mfxr-j63j (CVE-2026-44432):
27-
# urllib3 streaming-API vulnerabilities; patched in urllib3>=2.7.0. Only the
28-
# base conda env (python3.13) ships the vulnerable urllib3 2.6.3 as a transitive
29-
# dep (pulled by requests/other HTTP clients in the base image). No parent
30-
# package pins urllib3<2.7.0 with a tight upper bound, so a direct upgrade in
31-
# the base env is the simplest fix.
32-
RUN /opt/conda/bin/python -m pip install --no-cache-dir --upgrade 'urllib3>=2.7.0'
33-
345
COPY requirements.txt .
356
RUN pip install -r requirements.txt --no-cache-dir
367
# GHSA-jx93-g359-86wm, GHSA-hvwj-8w5g-28rg: sglang vulnerabilities; patched in >=0.5.10
@@ -59,6 +30,19 @@ RUN pip install transformers==5.5.4
5930
# all use loose floors and no released parent version forces >=1.2.2, so direct override
6031
# in the base conda env is the only fix path.
6132
RUN conda run -n base python -m pip install --no-cache-dir --upgrade 'python-dotenv>=1.2.2'
33+
# pip>=26.1: GHSA-jp4c-xjxw-mgf9 (CVE-2026-6357); shipped at 26.0.1 in both the BASE
34+
# conda env (python3.13) and the PTCA conda env (python3.10). Self-update before
35+
# wheel installation prevents newly-installed modules from being imported.
36+
# `pip install --upgrade` overwrites the dist-info, but leaves a stale
37+
# conda-meta/pip-26.0.1-*.json record in the PTCA env that the SCA scanner still
38+
# flags — remove it explicitly after the upgrade.
39+
RUN conda run -n base python -m pip install --no-cache-dir --upgrade 'pip>=26.1' \
40+
&& pip install --no-cache-dir --upgrade 'pip>=26.1' \
41+
&& rm -f /opt/conda/envs/ptca/conda-meta/pip-26.0.1-*.json \
42+
/opt/conda/conda-meta/pip-26.0.1-*.json
43+
# urllib3>=2.7.0: GHSA-qccp-gfcp-xxvc (CVE-2026-44431) and GHSA-mf9v-mfxr-j63j
44+
# (CVE-2026-44432); transitive dep at 2.6.3 in the BASE conda env (python3.13).
45+
RUN conda run -n base python -m pip install --no-cache-dir --upgrade 'urllib3>=2.7.0'
6246
# clean conda and pip caches
6347
RUN rm -rf ~/.cache/pip
6448
COPY loss /opt/conda/envs/ptca/lib/python3.10/site-packages/specforge/core/loss.py

assets/training/finetune_acft_hf_nlp/environments/acpt/context/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,27 @@ RUN conda run -n base python -m pip install --upgrade --no-cache-dir 'python-dot
5353
RUN conda install -n base -c conda-forge -y 'pip>=26.1.1' && \
5454
conda install -n ptca -c conda-forge -y 'pip>=26.1.1'
5555

56+
# py-rattler 0.23.2 (preinstalled in ACPT base via conda) ships a compiled rattler.abi3.so that
57+
# bundles vulnerable Rust crates — openssl 0.10.75 (5 CRITICAL), aws-lc-sys 0.37.1
58+
# (3 HIGH + 2 MEDIUM), bytes 1.11.0 (HIGH), tar 0.4.44 (HIGH + MEDIUM), rustls-webpki 0.103.9
59+
# (4 MEDIUM), rand 0.8.5/0.9.2 (MEDIUM). py-rattler 0.23.2 is the latest release on PyPI and still
60+
# ships the same vulnerable crates, so upgrading does not help. py-rattler is a conda packaging
61+
# helper not used by Hugging Face NLP finetune workloads. This step runs AFTER all conda install /
62+
# conda run steps so that conda's env-consistency checks cannot reinstall the .so from its package
63+
# cache. We:
64+
# 1. uninstall the package via conda + pip (to drop conda-meta and any pip RECORD);
65+
# 2. delete the site-packages dir, any leftover py(_|-)rattler*.dist-info metadata, and any
66+
# stray rattler.abi3.so, scanning the full filesystem (no -xdev) so /opt/conda symlinked to
67+
# /opt/miniconda on a different mount is also covered;
68+
# 3. delete the conda-meta JSON record so vulnerability scanners that read conda-meta no longer
69+
# list py-rattler as installed.
70+
RUN (conda remove -n base -y py-rattler 2>/dev/null || true) && \
71+
(conda run -n base python -m pip uninstall -y py-rattler 2>/dev/null || true) && \
72+
find / \( -path '*/site-packages/rattler' -o -name 'rattler.abi3.so' -o -name 'py_rattler-*.dist-info' -o -name 'py-rattler-*.dist-info' \) -prune -exec rm -rf {} + 2>/dev/null; \
73+
find / -path '*/conda-meta/py-rattler-*.json' -delete 2>/dev/null; \
74+
find / -path '*/conda-meta/py_rattler-*.json' -delete 2>/dev/null; \
75+
true
76+
5677
# clean conda and pip caches
5778
RUN rm -rf ~/.cache/pip
5879
RUN conda clean -a -y && rm -rf /opt/miniconda/pkgs/

assets/training/finetune_acft_image/environments/acft_image_medimageinsight_adapter_finetune/context/Dockerfile

Lines changed: 47 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ RUN apt-get -y install unzip
88

99
# pip 26.0.1 in both the base (py3.13) and ptca (py3.10) conda envs is
1010
# vulnerable to GHSA-jp4c-xjxw-mgf9 / CVE-2026-6357 (fixed in pip>=26.1).
11-
# pip is installed by conda from the upstream base image; there is no parent
12-
# Python package that brings it in, so an upstream parent upgrade is not
13-
# possible. The base ACPT image (biweekly.202605.2 as of 2026-05-19) still
14-
# ships pip 26.0.1 in both envs, so we override here. `conda install` is used
15-
# so conda-meta JSON and /opt/conda/pkgs cache are updated, and stale
16-
# pip-26.0*.dist-info / conda-meta entries from prior pip self-upgrades are
17-
# removed (conda does not track those, and the SBOM scanner re-flags them).
11+
# pip is a build/install tool installed by conda from the upstream base image
12+
# (mcr.microsoft.com/aifx/acpt/stable-ubuntu2204-cu126-py310-torch280, biweekly
13+
# tag) — there is no parent Python package that brings it in, so an upstream
14+
# parent upgrade is not possible. The base ACPT image has not yet refreshed to
15+
# pip 26.1+ as of 2026-05-12, so we override here. We use `conda install`
16+
# (rather than `pip install --upgrade`) so that conda-meta JSON and
17+
# /opt/conda/pkgs cache are also updated, and we additionally remove stray
18+
# pip-26.0*.dist-info / conda-meta entries from prior pip self-upgrades that
19+
# conda does not track — otherwise the SBOM scanner re-flags them. Done before
20+
# the requirements install so requirements are installed with the patched pip.
1821
RUN conda install -y -n base -c conda-forge pip==26.1.1 && \
1922
conda install -y -n ptca -c conda-forge pip==26.1.1 && \
2023
rm -rf /opt/conda/lib/python3.13/site-packages/pip-26.0*.dist-info && \
@@ -32,29 +35,45 @@ RUN pip install -r requirements.txt --no-cache-dir
3235
# `pip` resolves to the ptca env, so base-env overrides need /opt/conda/bin/pip.
3336
#
3437
# ptca env (py3.10):
35-
# pyasn1 (>=0.6.3, CVE-2026-30922): mlflow -> databricks-sdk -> google-auth
36-
# -> pyasn1-modules -> pyasn1; pyasn1-modules pins pyasn1 with no version
37-
# floor so pip may resolve <0.6.3.
38-
# Mako (>=1.3.11): mlflow -> alembic -> Mako; alembic 1.18.4 uses unpinned
39-
# `Requires-Dist: Mako`.
40-
# python-dotenv (>=1.2.2, GHSA-mf9w-mj56-hr94): mlflow -> mlflow-skinny ->
41-
# python-dotenv<2,>=0.19.0; mlflow 3.11.1 (latest as of 2026-05-19) keeps
42-
# that wide range.
43-
# (urllib3 is already 2.7.0 in the ptca env of biweekly.202605.2, so no
44-
# override is needed there.)
38+
# pyasn1: mlflow -> databricks-sdk -> google-auth -> pyasn1-modules -> pyasn1;
39+
# pyasn1-modules pins pyasn1 with no version floor so pip may resolve <0.6.3 (CVE-2026-30922)
40+
# Mako: mlflow -> alembic -> Mako; alembic 1.18.4 uses unpinned `Requires-Dist: Mako`
41+
# python-dotenv: mlflow -> mlflow-skinny -> python-dotenv<2,>=0.19.0;
42+
# mlflow 3.11.1 (latest as of 2026-05-08) keeps that wide range so pip may resolve <1.2.2 (GHSA-mf9w-mj56-hr94)
4543
#
4644
# base conda env (py3.13):
47-
# python-dotenv 1.2.1 is brought in by anaconda-auth 0.14.4
48-
# (`Requires-Dist: python-dotenv`, no version pin) and pydantic-settings
49-
# 2.12.0 (`python-dotenv>=0.21.0`); both are pre-installed in the base env
50-
# from the upstream base image and neither parent ships a tighter pin in
51-
# its latest release as of 2026-05-19, so we patch python-dotenv directly.
52-
# urllib3 2.6.3 (GHSA-qccp-gfcp-xxvc / CVE-2026-44431,
53-
# GHSA-mf9v-mfxr-j63j / CVE-2026-44432; fixed in 2.7.0) is brought in by
54-
# `requests` (`urllib3<3,>=1.26`). requests 2.32.5 (latest as of
55-
# 2026-05-19) keeps that wide range so no parent upgrade can pull in the
56-
# patched urllib3 — override directly via /opt/conda/bin/pip.
45+
# python-dotenv 1.2.1 is brought in by anaconda-auth 0.13.1 (`Requires-Dist: python-dotenv`,
46+
# no version pin) and pydantic-settings 2.12.0 (`python-dotenv>=0.21.0`); both are shipped
47+
# pre-installed in the base env from the upstream base image and neither parent ships a
48+
# tighter pin in its latest release as of 2026-05-08, so we patch python-dotenv directly
49+
# in the base env via /opt/conda/bin/pip.
5750
RUN pip install --no-cache-dir --upgrade 'pyasn1>=0.6.3' 'Mako>=1.3.11' 'python-dotenv>=1.2.2' \
58-
&& /opt/conda/bin/pip install --no-cache-dir --upgrade 'python-dotenv>=1.2.2' 'urllib3>=2.7.0'
51+
&& /opt/conda/bin/pip install --no-cache-dir --upgrade 'python-dotenv>=1.2.2'
52+
53+
# py-rattler bundles a compiled Rust extension (rattler.abi3.so) that statically
54+
# links several Rust crates. The version shipped in the upstream base image
55+
# (mcr.microsoft.com/aifx/acpt/stable-ubuntu2204-cu126-py310-torch280, biweekly
56+
# tag) bundles vulnerable crate versions: openssl 0.10.75 (5 CRITICAL CVEs:
57+
# CVE-2026-41676/41677/41678/41681/41898 — fixed in 0.10.78), aws-lc-sys 0.37.1
58+
# (3 HIGH + 2 MEDIUM — fixed in 0.38.0/0.39.0), bytes 1.11.0 (HIGH
59+
# CVE-2026-25541 — fixed in 1.11.1), tar 0.4.44 (HIGH + MEDIUM — fixed in
60+
# 0.4.45), rustls-webpki 0.103.9 (4 MEDIUM — fixed in 0.103.13), and rand
61+
# 0.8.5/0.9.2 (MEDIUM — fixed in 0.8.6/0.9.3). The latest py-rattler on PyPI as
62+
# of 2026-05-22 is 0.23.2 (released 2026-03-20), which still bundles these
63+
# vulnerable crate versions — upgrading does not help. py-rattler is only
64+
# used by conda-rattler-solver as an experimental solver backend for `conda`
65+
# itself; the default solver (libmamba) and classic solver remain available
66+
# and our training/finetune image does not invoke conda at runtime (all
67+
# package installs happen at build time, above). Therefore we remove the
68+
# package and the conda-rattler-solver plugin entirely from the base env to
69+
# eliminate the vulnerable abi3.so. We also clean any conda-meta entries so
70+
# the SBOM scanner does not re-flag the removed package.
71+
RUN /opt/conda/bin/pip uninstall -y py-rattler conda-rattler-solver || true && \
72+
rm -rf /opt/conda/lib/python3.13/site-packages/rattler \
73+
/opt/conda/lib/python3.13/site-packages/py_rattler* \
74+
/opt/conda/lib/python3.13/site-packages/py-rattler* \
75+
/opt/conda/lib/python3.13/site-packages/conda_rattler_solver* && \
76+
rm -f /opt/conda/conda-meta/py-rattler-*.json \
77+
/opt/conda/conda-meta/conda-rattler-solver-*.json
5978

6079
RUN conda clean -a -y && rm -rf /opt/miniconda/pkgs/

assets/training/finetune_acft_image/environments/acft_image_mmdetection/context/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,19 @@ RUN pip install --no-cache-dir --no-deps 'diffusers==0.38.0'
6464
RUN pip install --no-cache-dir --upgrade 'urllib3>=2.7.0,<3' \
6565
&& /opt/conda/bin/python3.13 -m pip install --no-cache-dir --upgrade 'urllib3>=2.7.0,<3'
6666

67+
# Remove vulnerable py-rattler from the base (py3.13) env.
68+
# Root cause (verified 2026-05 against the built image and PyPI):
69+
# - The base image ships py-rattler 0.23.2 (latest stable) plus the conda-rattler-solver
70+
# plugin in /opt/conda (base env). The compiled rattler.abi3.so still bundles
71+
# vulnerable Rust crates: openssl 0.10.75 (5 CRITICAL CVEs), aws-lc-sys 0.37.1
72+
# (3 HIGH + 2 MEDIUM), bytes 1.11.0 (HIGH), tar 0.4.44 (HIGH + MEDIUM),
73+
# rustls-webpki 0.103.9 (4 MEDIUM), rand 0.8.5/0.9.2 (MEDIUM) — 18 findings total.
74+
# - py-rattler 0.23.2 is the newest published version on PyPI (checked 2026-05-22),
75+
# so an upgrade-in-place cannot pick up patched Rust crates yet.
76+
# - rattler is only the conda dependency solver; ML workloads run in the ptca
77+
# (py3.10) env and do not import it. Switching conda back to the classic solver
78+
# keeps `conda` itself working after the rattler packages are removed.
79+
RUN conda config --system --set solver classic \
80+
&& /opt/conda/bin/python3.13 -m pip uninstall -y py-rattler conda-rattler-solver
81+
6782
RUN conda clean -a -y && rm -rf /opt/miniconda/pkgs/

0 commit comments

Comments
 (0)