{"api_version":"1","generated_at":"2026-07-23T12:53:29+00:00","cve":"CVE-2021-3726","urls":{"html":"https://cve.report/CVE-2021-3726","api":"https://cve.report/api/cve/CVE-2021-3726.json","docs":"https://cve.report/api","cve_org":"https://www.cve.org/CVERecord?id=CVE-2021-3726","nvd":"https://nvd.nist.gov/vuln/detail/CVE-2021-3726"},"summary":{"title":"CVE-2021-3726","description":"# Vulnerability in `title` function **Description**: the `title` function defined in `lib/termsupport.zsh` uses `print` to set the terminal title to a user-supplied string. In Oh My Zsh, this function is always used securely, but custom user code could use the `title` function in a way that is unsafe. **Fixed in**: [a263cdac](https://github.com/ohmyzsh/ohmyzsh/commit/a263cdac). **Impacted areas**: - `title` function in `lib/termsupport.zsh`. - Custom user code using the `title` function.","state":"PUBLIC","assigner":"security@huntr.dev","published_at":"2021-11-30 10:15:00","updated_at":"2021-11-30 20:49:00"},"problem_types":["CWE-78"],"metrics":[],"references":[{"url":"https://github.com/ohmyzsh/ohmyzsh/commit/a263cdac","name":"https://github.com/ohmyzsh/ohmyzsh/commit/a263cdac","refsource":"MISC","tags":[],"title":"fix(lib): fix potential command injection in `title` and `spectrum` f… · ohmyzsh/ohmyzsh@a263cda · GitHub","mime":"text/html","httpstatus":"200","archivestatus":"404"},{"url":"https://www.cve.org/CVERecord?id=CVE-2021-3726","name":"CVE Program record","refsource":"CVE.ORG","tags":["canonical"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-3726","name":"NVD vulnerability detail","refsource":"NVD","tags":["canonical","analysis"]}],"affected":[],"timeline":[],"solutions":[],"workarounds":[],"exploits":[],"credits":[],"nvd_cpes":[{"cve_year":"2021","cve_id":"3726","vulnerable":"1","versionEndIncluding":"","cpe1":"cpe","cpe2":"2.3","cpe3":"a","cpe4":"planetargon","cpe5":"oh_my_zsh","cpe6":"*","cpe7":"*","cpe8":"*","cpe9":"*","cpe10":"*","cpe11":"*","cpe12":"*","cpe13":"*"}],"vendor_comments":[],"enrichments":{"kev":null,"epss":null,"legacy_qids":[]},"source_records":{"cve_program":{"CVE_data_meta":{"ASSIGNER":"security@huntr.dev","ID":"CVE-2021-3726","STATE":"PUBLIC","TITLE":"OS Command Injection in ohmyzsh/ohmyzsh"},"affects":{"vendor":{"vendor_data":[{"product":{"product_data":[{"product_name":"ohmyzsh/ohmyzsh","version":{"version_data":[{"version_affected":"<","version_value":"a263cdac"}]}}]},"vendor_name":"ohmyzsh"}]}},"data_format":"MITRE","data_type":"CVE","data_version":"4.0","description":{"description_data":[{"lang":"eng","value":"# Vulnerability in `title` function **Description**: the `title` function defined in `lib/termsupport.zsh` uses `print` to set the terminal title to a user-supplied string. In Oh My Zsh, this function is always used securely, but custom user code could use the `title` function in a way that is unsafe. **Fixed in**: [a263cdac](https://github.com/ohmyzsh/ohmyzsh/commit/a263cdac). **Impacted areas**: - `title` function in `lib/termsupport.zsh`. - Custom user code using the `title` function."}]},"exploit":[{"lang":"eng","value":"**Exploit PoC**:\n\n1. Install Oh My Zsh.\n2. Add a custom function that calls `title` to set the terminal title with a user-supplied string.\n   For example:\n\n   ```sh\n   function dirpath_in_title {\n     title \"$PWD\"\n   }\n   add-zsh-hook precmd dirpath_in_title\n   ```\n\n3. Create and cd into a directory with a subshell command as its name:\n\n   ```sh\n   baddir='`echo pwned && id`'\n   mkdir \"$baddir\" && cd \"$baddir\"\n   ```\n\n4. The `title` function incorrectly expands the subshell command (see screenshot):\n\n   ![2 title_function poc](https://user-images.githubusercontent.com/1441704/142874935-341ddd3c-21e8-4b9e-a5c1-77c0b3debacc.png)"}],"impact":{"cvss":{"attackComplexity":"HIGH","attackVector":"NETWORK","availabilityImpact":"HIGH","baseScore":7.5,"baseSeverity":"MEDIUM","confidentialityImpact":"HIGH","integrityImpact":"HIGH","privilegesRequired":"NONE","scope":"UNCHANGED","userInteraction":"REQUIRED","vectorString":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H","version":"3.1"}},"problemtype":{"problemtype_data":[{"description":[{"lang":"eng","value":"CWE-78 OS Command Injection"}]}]},"references":{"reference_data":[{"name":"https://github.com/ohmyzsh/ohmyzsh/commit/a263cdac","refsource":"MISC","url":"https://github.com/ohmyzsh/ohmyzsh/commit/a263cdac"}]}},"nvd":{"publishedDate":"2021-11-30 10:15:00","lastModifiedDate":"2021-11-30 20:49:00","problem_types":["CWE-78"],"metrics":{"baseMetricV3":{"cvssV3":{"version":"3.1","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","attackVector":"NETWORK","attackComplexity":"LOW","privilegesRequired":"NONE","userInteraction":"NONE","scope":"UNCHANGED","confidentialityImpact":"HIGH","integrityImpact":"HIGH","availabilityImpact":"HIGH","baseScore":9.8,"baseSeverity":"CRITICAL"},"exploitabilityScore":3.9,"impactScore":5.9},"baseMetricV2":{"cvssV2":{"version":"2.0","vectorString":"AV:N/AC:L/Au:N/C:P/I:P/A:P","accessVector":"NETWORK","accessComplexity":"LOW","authentication":"NONE","confidentialityImpact":"PARTIAL","integrityImpact":"PARTIAL","availabilityImpact":"PARTIAL","baseScore":7.5},"severity":"HIGH","exploitabilityScore":10,"impactScore":6.4,"acInsufInfo":false,"obtainAllPrivilege":false,"obtainUserPrivilege":false,"obtainOtherPrivilege":false,"userInteractionRequired":false}},"configurations":{"CVE_data_version":"4.0","nodes":[{"operator":"OR","children":[],"cpe_match":[{"vulnerable":true,"cpe23Uri":"cpe:2.3:a:planetargon:oh_my_zsh:*:*:*:*:*:*:*:*","versionEndExcluding":"2021-11-11","cpe_name":[]}]}]}},"legacy_mitre":{"record":{"CveYear":"2021","CveId":"3726","Ordinal":"214997","Title":"CVE-2021-3726","CVE":"CVE-2021-3726","Year":"2021"},"notes":[{"CveYear":"2021","CveId":"3726","Ordinal":"1","NoteData":"# Vulnerability in `title` function **Description**: the `title` function defined in `lib/termsupport.zsh` uses `print` to set the terminal title to a user-supplied string. In Oh My Zsh, this function is always used securely, but custom user code could use the `title` function in a way that is unsafe. **Fixed in**: [a263cdac](https://github.com/ohmyzsh/ohmyzsh/commit/a263cdac). **Impacted areas**: - `title` function in `lib/termsupport.zsh`. - Custom user code using the `title` function.","Type":"Description","Title":null},{"CveYear":"2021","CveId":"3726","Ordinal":"2","NoteData":"2021-11-30","Type":"Other","Title":"Published"},{"CveYear":"2021","CveId":"3726","Ordinal":"3","NoteData":"2021-11-30","Type":"Other","Title":"Modified"}]}}}