| {"messages": [{"content": "You are a security engineer fixing a CVE. You are given the vulnerability description (symptom only) and the vulnerable source window. Author the MINIMAL fix as a unified diff. Follow these rules exactly:\n1. Target ONLY the file named in the `# Vulnerable source (...)` header \u2014 do not invent or substitute file paths.\n2. Modify ONLY code visible in the shown source window.\n3. Change as few lines as possible; do not rewrite surrounding logic.\n4. Output only the unified diff with no other text.\n5. Prefer the minimal structural change: if an existing condition is missing a check, add it inline to that condition rather than inserting a new code block. If existing code is redundant or overcomplicated, replace it \u2014 do not add more code around it.\n6. Edit the most specific method or class that directly handles the vulnerable operation \u2014 not a base class, interface, or Protocol definition.", "role": "system"}, {"content": "# CVE\nCVE-2022-37434: Heap-buffer-overflow (CWE-787 out-of-bounds write) in zlib 1.2.12's inflate() gzip-header EXTRA-field handling (inflate.c). nixpkgs ships zlib 1.2.12 at the pre-fix rev.\n\n# Vulnerable source (inflate.c)\n```c\n state->mode = EXLEN;\n /* fallthrough */\n case EXLEN:\n if (state->flags & 0x0400) {\n NEEDBITS(16);\n state->length = (unsigned)(hold);\n if (state->head != Z_NULL)\n state->head->extra_len = (unsigned)hold;\n if ((state->flags & 0x0200) && (state->wrap & 4))\n CRC2(state->check, hold);\n INITBITS();\n }\n else if (state->head != Z_NULL)\n state->head->extra = Z_NULL;\n state->mode = EXTRA;\n /* fallthrough */\n case EXTRA:\n if (state->flags & 0x0400) {\n copy = state->length;\n if (copy > have) copy = have;\n if (copy) {\n if (state->head != Z_NULL &&\n state->head->extra != Z_NULL) {\n len = state->head->extra_len - state->length;\n zmemcpy(state->head->extra + len, next,\n len + copy > state->head->extra_max ?\n state->head->extra_max - len : copy);\n }\n if ((state->flags & 0x0200) && (state->wrap & 4))\n state->check = crc32(state->check, next, copy);\n have -= copy;\n next += copy;\n state->length -= copy;\n }\n if (state->length) goto inf_leave;\n }\n state->length = 0;\n state->mode = NAME;\n /* fallthrough */\n case NAME:\n```", "role": "user"}, {"content": "diff --git a/inflate.c b/inflate.c\n--- a/inflate.c\n+++ b/inflate.c\n@@ -764,8 +764,9 @@ int flush;\n if (copy > have) copy = have;\n if (copy) {\n if (state->head != Z_NULL &&\n- state->head->extra != Z_NULL) {\n- len = state->head->extra_len - state->length;\n+ state->head->extra != Z_NULL &&\n+ (len = state->head->extra_len - state->length) <\n+ state->head->extra_max) {\n zmemcpy(state->head->extra + len, next,\n len + copy > state->head->extra_max ?\n state->head->extra_max - len : copy);", "role": "assistant"}], "provenance": {"attr_path": "zlib", "authoring_multifile_status": "single-file", "authoring_validation_tier": "behavioral-only", "backport_validated": true, "bundle_id": "dc5657a2a24de9f8", "cert_green": false, "cve_id": "CVE-2022-37434", "eligible_under_multifile_v1": true, "fix_commit": "eff308af425b67093bab25f80f1ae950166bece1", "included_source_files": ["inflate.c"], "input_window_truncated": false, "kind": "human-review-required", "label_file_count": 1, "label_grounding_source": "upstream-commit", "omitted_source_files": [], "split_family": "zlib", "steward_signed": false}, "split": "canary", "task": "author-from-vuln"} |
| {"messages": [{"content": "You are a security engineer fixing a CVE. You are given the vulnerability description (symptom only) and the vulnerable source window. Author the MINIMAL fix as a unified diff. Follow these rules exactly:\n1. Target ONLY the file named in the `# Vulnerable source (...)` header \u2014 do not invent or substitute file paths.\n2. Modify ONLY code visible in the shown source window.\n3. Change as few lines as possible; do not rewrite surrounding logic.\n4. Output only the unified diff with no other text.\n5. Prefer the minimal structural change: if an existing condition is missing a check, add it inline to that condition rather than inserting a new code block. If existing code is redundant or overcomplicated, replace it \u2014 do not add more code around it.\n6. Edit the most specific method or class that directly handles the vulnerable operation \u2014 not a base class, interface, or Protocol definition.", "role": "system"}, {"content": "# CVE\nCVE-2024-47081: Credential leak (CWE-522, insufficiently protected credentials) in python-requests' netrc handling. Disclosed at https://seclists.org/fulldisclosure/2025/Jun/2 .\n\n# Vulnerable source (src/requests/utils.py)\n```python\n from netrc import NetrcParseError, netrc\n\n netrc_path = None\n\n for f in netrc_locations:\n try:\n loc = os.path.expanduser(f)\n except KeyError:\n # os.path.expanduser can fail when $HOME is undefined and\n # getpwuid fails. See https://bugs.python.org/issue20164 &\n # https://github.com/psf/requests/issues/1846\n return\n\n if os.path.exists(loc):\n netrc_path = loc\n break\n\n # Abort early if there isn't one.\n if netrc_path is None:\n return\n\n ri = urlparse(url)\n\n # Strip port numbers from netloc. This weird `if...encode`` dance is\n # used for Python 3.2, which doesn't support unicode literals.\n splitstr = b\":\"\n if isinstance(url, str):\n splitstr = splitstr.decode(\"ascii\")\n host = ri.netloc.split(splitstr)[0]\n\n try:\n _netrc = netrc(netrc_path).authenticators(host)\n if _netrc:\n # Return with login / password\n login_i = 0 if _netrc[0] else 1\n return (_netrc[login_i], _netrc[2])\n except (NetrcParseError, OSError):\n # If there was a parsing error or a permissions issue reading the file,\n # we'll just skip netrc auth unless explicitly asked to raise errors.\n if raise_errors:\n```", "role": "user"}, {"content": "diff --git a/src/requests/utils.py b/src/requests/utils.py\n--- a/src/requests/utils.py\n+++ b/src/requests/utils.py\n@@ -236,13 +236,7 @@ def get_netrc_auth(url, raise_errors=False):\n return\n \n ri = urlparse(url)\n-\n- # Strip port numbers from netloc. This weird `if...encode`` dance is\n- # used for Python 3.2, which doesn't support unicode literals.\n- splitstr = b\":\"\n- if isinstance(url, str):\n- splitstr = splitstr.decode(\"ascii\")\n- host = ri.netloc.split(splitstr)[0]\n+ host = ri.hostname\n \n try:\n _netrc = netrc(netrc_path).authenticators(host)", "role": "assistant"}], "provenance": {"attr_path": "python3Packages.requests", "authoring_multifile_status": "single-file", "authoring_validation_tier": "behavioral-only", "backport_validated": true, "bundle_id": "ec631e58cb58f711", "cert_green": false, "cve_id": "CVE-2024-47081", "eligible_under_multifile_v1": true, "fix_commit": "57acb7c26d809cf864ec439b8bcd6364702022d5", "included_source_files": ["src/requests/utils.py"], "input_window_truncated": false, "kind": "human-review-required", "label_file_count": 1, "label_grounding_source": "upstream-commit", "omitted_source_files": [], "split_family": "pythonPackages.requests", "steward_signed": false}, "split": "canary", "task": "author-from-vuln"} |
| {"messages": [{"content": "You are a security engineer fixing a CVE. You are given the vulnerability description (symptom only) and the vulnerable source window. Author the MINIMAL fix as a unified diff. Follow these rules exactly:\n1. Target ONLY the file named in the `# Vulnerable source (...)` header \u2014 do not invent or substitute file paths.\n2. Modify ONLY code visible in the shown source window.\n3. Change as few lines as possible; do not rewrite surrounding logic.\n4. Output only the unified diff with no other text.\n5. Prefer the minimal structural change: if an existing condition is missing a check, add it inline to that condition rather than inserting a new code block. If existing code is redundant or overcomplicated, replace it \u2014 do not add more code around it.\n6. Edit the most specific method or class that directly handles the vulnerable operation \u2014 not a base class, interface, or Protocol definition.", "role": "system"}, {"content": "# CVE\nCVE-2026-42250: Off-by-one out-of-bounds write (CWE-787) in bzip2's bzip2recover utility (bzip2recover.c) <= 1.0.8.\n\n# Vulnerable source (bzip2recover.c)\n```c\n buffHi = (buffHi << 1) | (buffLo >> 31);\n buffLo = (buffLo << 1) | (b & 1);\n if ( ( (buffHi & 0x0000ffff) == BLOCK_HEADER_HI \n && buffLo == BLOCK_HEADER_LO)\n || \n ( (buffHi & 0x0000ffff) == BLOCK_ENDMARK_HI \n && buffLo == BLOCK_ENDMARK_LO)\n ) {\n if (bitsRead > 49) {\n bEnd[currBlock] = bitsRead-49;\n } else {\n bEnd[currBlock] = 0;\n }\n if (currBlock > 0 &&\n\t (bEnd[currBlock] - bStart[currBlock]) >= 130) {\n fprintf ( stderr, \" block %d runs from \" MaybeUInt64_FMT \n \" to \" MaybeUInt64_FMT \"\\n\",\n rbCtr+1, bStart[currBlock], bEnd[currBlock] );\n rbStart[rbCtr] = bStart[currBlock];\n rbEnd[rbCtr] = bEnd[currBlock];\n rbCtr++;\n }\n if (currBlock >= BZ_MAX_HANDLED_BLOCKS)\n tooManyBlocks(BZ_MAX_HANDLED_BLOCKS);\n currBlock++;\n\n bStart[currBlock] = bitsRead;\n }\n }\n\n bsClose ( bsIn );\n\n /*-- identified blocks run from 1 to rbCtr inclusive. --*/\n\n if (rbCtr < 1) {\n fprintf ( stderr,\n \"%s: sorry, I couldn't find any block boundaries.\\n\",\n progName );\n exit(1);\n };\n```", "role": "user"}, {"content": "diff --git a/bzip2recover.c b/bzip2recover.c\n--- a/bzip2recover.c\n+++ b/bzip2recover.c\n@@ -402,5 +402,5 @@\n rbCtr++;\n }\n- if (currBlock >= BZ_MAX_HANDLED_BLOCKS)\n+ if (currBlock >= BZ_MAX_HANDLED_BLOCKS - 1)\n tooManyBlocks(BZ_MAX_HANDLED_BLOCKS);\n currBlock++;", "role": "assistant"}], "provenance": {"attr_path": "bzip2", "authoring_multifile_status": "single-file", "authoring_validation_tier": "behavioral-only", "backport_validated": true, "bundle_id": "1c8f4ceb1ff4ac6a", "cert_green": false, "cve_id": "CVE-2026-42250", "eligible_under_multifile_v1": true, "fix_commit": "35d122a3df8b0cc4082a4d89fdc6ee99f375fe67", "included_source_files": ["bzip2recover.c"], "input_window_truncated": false, "kind": "human-review-required", "label_file_count": 1, "label_grounding_source": "upstream-commit", "omitted_source_files": [], "split_family": "bzip", "steward_signed": false}, "split": "canary", "task": "author-from-vuln"} |
| {"messages": [{"content": "You are a security engineer fixing a CVE. You are given the vulnerability description (symptom only) and the vulnerable source window. Author the MINIMAL fix as a unified diff. Follow these rules exactly:\n1. Target ONLY the file named in the `# Vulnerable source (...)` header \u2014 do not invent or substitute file paths.\n2. Modify ONLY code visible in the shown source window.\n3. Change as few lines as possible; do not rewrite surrounding logic.\n4. Output only the unified diff with no other text.\n5. Prefer the minimal structural change: if an existing condition is missing a check, add it inline to that condition rather than inserting a new code block. If existing code is redundant or overcomplicated, replace it \u2014 do not add more code around it.\n6. Edit the most specific method or class that directly handles the vulnerable operation \u2014 not a base class, interface, or Protocol definition.", "role": "system"}, {"content": "# CVE\nCVE-2026-48526: (GHSA-xgmm-8j9v-c9wx)\n\n# Vulnerable source (jwt/algorithms.py)\n```python\n\n @staticmethod\n def from_jwk(jwk: str | JWKDict) -> NoReturn:\n raise NotImplementedError()\n\n\nclass HMACAlgorithm(Algorithm):\n \"\"\"\n Performs signing and verification operations using HMAC\n and the specified hash function.\n \"\"\"\n\n SHA256: ClassVar[HashlibHash] = hashlib.sha256\n SHA384: ClassVar[HashlibHash] = hashlib.sha384\n SHA512: ClassVar[HashlibHash] = hashlib.sha512\n\n def __init__(self, hash_alg: HashlibHash) -> None:\n self.hash_alg = hash_alg\n\n def prepare_key(self, key: str | bytes) -> bytes:\n key_bytes = force_bytes(key)\n\n if is_pem_format(key_bytes) or is_ssh_key(key_bytes):\n raise InvalidKeyError(\n \"The specified key is an asymmetric key or x509 certificate and\"\n \" should not be used as an HMAC secret.\"\n )\n\n return key_bytes\n\n @overload\n @staticmethod\n def to_jwk(key_obj: str | bytes, as_dict: Literal[True]) -> JWKDict: ...\n\n @overload\n @staticmethod\n def to_jwk(key_obj: str | bytes, as_dict: Literal[False] = False) -> str: ...\n\n @staticmethod\n def to_jwk(key_obj: str | bytes, as_dict: bool = False) -> JWKDict | str:\n```", "role": "user"}, {"content": "diff --git a/jwt/algorithms.py b/jwt/algorithms.py\n--- a/jwt/algorithms.py\n+++ b/jwt/algorithms.py\n@@ -325,12 +325,35 @@ def __init__(self, hash_alg: HashlibHash) -> None:\n def prepare_key(self, key: str | bytes) -> bytes:\n key_bytes = force_bytes(key)\n\n+ if len(key_bytes) == 0:\n+ raise InvalidKeyError(\"HMAC key must not be empty.\")\n+\n if is_pem_format(key_bytes) or is_ssh_key(key_bytes):\n raise InvalidKeyError(\n \"The specified key is an asymmetric key or x509 certificate and\"\n \" should not be used as an HMAC secret.\"\n )\n\n+ # Defense against algorithm-confusion attacks: an attacker with\n+ # control over the token header can force this code path by setting\n+ # alg=HS*, and HMACAlgorithm is the only algorithm that accepts\n+ # arbitrary bytes as a valid secret. Other algorithms reject\n+ # non-key-shaped input naturally. Even a symmetric (kty=oct) JWK\n+ # should be loaded via PyJWK / from_jwk rather than fed as raw JSON\n+ # bytes (whose contents are not the secret material).\n+ stripped = key_bytes.lstrip()\n+ if stripped.startswith(b\"{\"):\n+ try:\n+ jwk_obj = json.loads(key_bytes)\n+ except ValueError:\n+ jwk_obj = None\n+ if isinstance(jwk_obj, dict) and \"kty\" in jwk_obj:\n+ raise InvalidKeyError(\n+ \"The specified key looks like a JWK and should not be \"\n+ \"used directly as an HMAC secret. Load it via \"\n+ \"PyJWK / HMACAlgorithm.from_jwk first.\"\n+ )\n+\n return key_bytes\n\n @overload", "role": "assistant"}], "provenance": {"attr_path": "python3Packages.pyjwt", "authoring_multifile_status": "single-file", "authoring_validation_tier": "behavioral-only", "backport_validated": true, "bundle_id": "43d87d75324e9cd6", "cert_green": false, "cve_id": "CVE-2026-48526", "eligible_under_multifile_v1": true, "fix_commit": "95791b1759b8aa4f2203575d344d5c78564cdc81", "included_source_files": ["jwt/algorithms.py"], "input_window_truncated": false, "kind": "human-review-required", "label_file_count": 1, "label_grounding_source": "upstream-commit", "omitted_source_files": [], "split_family": "pythonPackages.pyjwt", "steward_signed": false}, "split": "canary", "task": "author-from-vuln"} |
|
|