---
id: CVE-2022-0845
aliases:
  - GHSA-r5qj-cvf9-p85h
  - PYSEC-2022-181
  - PYSEC-2026-3969
title: Code Injection in PyTorch Lightning
summary: Code Injection in PyTorch Lightning
severity: critical
cvss: 9.8
cvssVector: 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H'
vendor: pytorch-lightning
product: pytorch-lightning
ecosystem: pip
affected:
  - pytorch-lightning < 1.6.0
patched:
  - pytorch-lightning 1.6.0
published: '2022-03-06'
updated: '2026-09-10'
sourceUpdated: '2026-09-10T17:26:06.105487760Z'
source: OSV
sourceUrl: 'https://osv.dev/vulnerability/GHSA-r5qj-cvf9-p85h'
references:
  - url: 'https://nvd.nist.gov/vuln/detail/CVE-2022-0845'
  - url: 'https://github.com/PyTorchLightning/pytorch-lightning/pull/12212'
  - url: >-
      https://github.com/pytorchlightning/pytorch-lightning/commit/8b7a12c52e52a06408e9231647839ddb4665e8ae
  - url: 'https://github.com/advisories/GHSA-r5qj-cvf9-p85h'
  - url: >-
      https://github.com/pypa/advisory-database/tree/main/vulns/pytorch-lightning/PYSEC-2022-181.yaml
  - url: 'https://github.com/pytorchlightning/pytorch-lightning'
  - url: 'https://huntr.dev/bounties/a795bf93-c91e-4c79-aae8-f7d8bda92e2a'
tags:
  - osv
  - pip
epss: 0.0098
epssPercentile: 0.60209
ingestedAt: '2026-09-12T03:13:01.724Z'
---

## Overview

PyTorch Lightning version 1.5.10 and prior is vulnerable to code injection. An attacker could execute commands on the target OS running the operating system by setting the `PL_TRAINER_GPUS` when using the `Trainer` module. A [patch](https://github.com/pytorchlightning/pytorch-lightning/commit/8b7a12c52e52a06408e9231647839ddb4665e8ae) is included in the `1.6.0` release.

## Affected packages

- `pytorch-lightning < 1.6.0`

## Remediation

Upgrade to a patched release:

- `pytorch-lightning 1.6.0`
