{"id":"HSEC-2025-0005","aliases":["HSEC-2025-0005"],"related":[],"kind":"vulnerability","state":"published","title":"cabal-install dependency confusion","summary":"# `cabal-install` dependency confusion\n\nFor **cabal-install < 3.4.0.0** and where multiple repositories are\nconfigured, the resolver picks the highest available version across\nall repositories.  Where a package is only defined in a private\nrepository, this behaviour leads to a [*dependency confusion*][blog]\nsupply chain vulnerability.  If the private package name becomes\nknown, a malicious actor can claim the name in the public repository\nand publish a malicious version at a higher version number.\n\nDefault `cabal-install` configurations that only use the\n`hackage.haskell.org` repository are not affected.  Configurations\nthat use curated private repositories **exclusively** are also not\naffected.\n\n[blog]: https://frasertweedale.github.io/blog-fp/posts/2021-02-12-haskell-dependency-confusion.html\n\n\n## Mitigations\n\n*cabal-install* version **3.4.0.0** and higher provide an `override`\noption in the repository configuration.  It marks the associated\nrepository as canonical for all packages defined in that repository.\nNo other repositories will be considered.  For example:\n\n```\n-- For packages in repo.example.com,\n-- only versions in repo.example.com are considered\nactive-repositories:\n  , hackage.haskell.org\n  , repo.example.com:override\n```\n\nUsers and organisations using private repositories that contain\nprivate packages in addition to public repositories **MUST** use the\n`override` option to prevent dependency confusion attacks.\n\nAlternatively, projects and organisations can run a private instance\nof *hackage-server* and carefully curate and review its contents.\nUsing that instance exclusively defeats supply chain attacks\nincluding *dependency confusion*.  For *cabal-install < 3.4* and\nwhere using multiple repositories, this is the only effective\nmitigation against dependency confusion attacks.","summaryFormat":"markdown","summarySource":"hsec","descriptions":[{"lang":"en","text":"# `cabal-install` dependency confusion\n\nFor **cabal-install < 3.4.0.0** and where multiple repositories are\nconfigured, the resolver picks the highest available version across\nall repositories.  Where a package is only defined in a private\nrepository, this behaviour leads to a [*dependency confusion*][blog]\nsupply chain vulnerability.  If the private package name becomes\nknown, a malicious actor can claim the name in the public repository\nand publish a malicious version at a higher version number.\n\nDefault `cabal-install` configurations that only use the\n`hackage.haskell.org` repository are not affected.  Configurations\nthat use curated private repositories **exclusively** are also not\naffected.\n\n[blog]: https://frasertweedale.github.io/blog-fp/posts/2021-02-12-haskell-dependency-confusion.html\n\n\n## Mitigations\n\n*cabal-install* version **3.4.0.0** and higher provide an `override`\noption in the repository configuration.  It marks the associated\nrepository as canonical for all packages defined in that repository.\nNo other repositories will be considered.  For example:\n\n```\n-- For packages in repo.example.com,\n-- only versions in repo.example.com are considered\nactive-repositories:\n  , hackage.haskell.org\n  , repo.example.com:override\n```\n\nUsers and organisations using private repositories that contain\nprivate packages in addition to public repositories **MUST** use the\n`override` option to prevent dependency confusion attacks.\n\nAlternatively, projects and organisations can run a private instance\nof *hackage-server* and carefully curate and review its contents.\nUsing that instance exclusively defeats supply chain attacks\nincluding *dependency confusion*.  For *cabal-install < 3.4* and\nwhere using multiple repositories, this is the only effective\nmitigation against dependency confusion attacks.","format":"markdown","source":"hsec"}],"published":"2025-11-14T14:45:34.000Z","modified":"2025-11-14T18:15:46.044Z","severities":[],"cwes":[],"affected":[{"ranges":[{"type":"ecosystem","introduced":"1.0.0.0","status":"affected","fixed":"3.4.0.0"}],"ecosystem":"Hackage","package":"cabal-install","purl":"pkg:hackage/cabal-install","source":"hsec"}],"references":[{"url":"https://frasertweedale.github.io/blog-fp/posts/2021-02-12-haskell-dependency-confusion.html","tags":["report"],"sources":["hsec"]}],"credits":[],"sources":[{"source":"hsec","name":"Haskell Security Advisories","id":"HSEC-2025-0005","url":"https://osv.dev/vulnerability/HSEC-2025-0005","licence":"CC0-1.0","modified":"2025-11-14T18:15:46.044Z"}],"updatedAt":"2026-11-25T22:56:25.651Z"}