{"id":"CVE-2017-5223","aliases":["DEBIAN-CVE-2017-5223","DLA-1591-1","DLA-817-1","EUVD-2020-0329","GHSA-4x5h-cr29-fhp6","MGASA-2017-0022","UBUNTU-CVE-2017-5223","USN-5956-1"],"status":"published","title":"Local file disclosure in PHPMailer","description":"An issue was discovered in PHPMailer before 5.2.22. PHPMailer's msgHTML method applies transformations to an HTML document to make it usable as an email message body. One of the transformations is to convert relative image URLs into attachments using a script-provided base directory. If no base directory is provided, it resolves to /, meaning that relative image URLs get treated as absolute local file paths and added as attachments. To form a remote vulnerability, the msgHTML method must be called, passed an unfiltered, user-supplied HTML document, and must not set a base directory.","severity":{"version":"3.0","score":5.5,"vector":"CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","level":"medium","assessor":"primary","from":"nvd"},"epss":{"day":"2026-11-08","score":0.02143,"percentile":0.82189,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":true,"fix_available":true},"cwes":["CWE-200"],"published":"2017-01-16T06:00:00Z","modified":"2026-10-20T10:48:28Z","exploits":[{"source":"exploitdb","id":"EDB-43056","title":"PHPMailer \u003c 5.2.21 - Local File Disclosure","type":"webapps","platform":"php","date":"2017-10-25","url":"https://www.exploit-db.com/exploits/43056"},{"source":"pocgithub","id":"cscli/CVE-2017-5223","title":"cscli/CVE-2017-5223","date":"2018-09-26","url":"https://github.com/cscli/CVE-2017-5223"}],"fixes":[{"ecosystem":"Packagist","package":"phpmailer/phpmailer","fixed_in":["5.2.22"],"sources":["ghsa","osv"]},{"ecosystem":"Debian:12","package":"libphp-phpmailer","fixed_in":["5.2.14+dfsg-2.3"],"sources":["osv"]},{"ecosystem":"Debian:13","package":"libphp-phpmailer","fixed_in":["5.2.14+dfsg-2.3"],"sources":["osv"]},{"ecosystem":"Debian:14","package":"libphp-phpmailer","fixed_in":["5.2.14+dfsg-2.3"],"sources":["osv"]},{"ecosystem":"Debian:7","package":"libphp-phpmailer","fixed_in":["5.1-1.3+deb7u1"],"sources":["osv"]},{"ecosystem":"Ubuntu:Pro:16.04:LTS","package":"libphp-phpmailer","fixed_in":["5.2.14+dfsg-1ubuntu0.1~esm1"],"sources":["osv"]}],"affected":[{"source":"ghsa","ecosystem":"Packagist","package":"phpmailer/phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"5.0.0"},{"fixed":"5.2.22"}]}]},{"source":"osv","ecosystem":"Debian:12","package":"libphp-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.2.14+dfsg-2.3"}]}]},{"source":"osv","ecosystem":"Debian:13","package":"libphp-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.2.14+dfsg-2.3"}]}]},{"source":"osv","ecosystem":"Debian:14","package":"libphp-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.2.14+dfsg-2.3"}]}]},{"source":"osv","ecosystem":"Debian:8","package":"libphp-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.2.9+dfsg-2+deb8u4"}]}],"versions":["5.2.9+dfsg-2","5.2.9+dfsg-2+deb8u1","5.2.9+dfsg-2+deb8u2","5.2.9+dfsg-2+deb8u3"],"bundled":2},{"source":"osv","ecosystem":"Debian:7","package":"libphp-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.1-1.3+deb7u1"}]}],"versions":["5.1-1","5.1-1.1","5.1-1.2","5.1-1.3"]},{"source":"osv","ecosystem":"Packagist","package":"phpmailer/phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"5.0.0"},{"fixed":"5.2.22"}]}],"versions":["v5.2.10","v5.2.11","v5.2.12","v5.2.13","v5.2.14","v5.2.15","v5.2.16","v5.2.17","v5.2.18","v5.2.19","v5.2.2","v5.2.20","v5.2.21","v5.2.4","v5.2.5","v5.2.6","v5.2.7","v5.2.8","v5.2.9"]},{"source":"osv","ecosystem":"Mageia:5","package":"php-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.2.22-1.mga5"}]}],"bundled":2},{"source":"osv","ecosystem":"Ubuntu:Pro:16.04:LTS","package":"libphp-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.2.14+dfsg-1ubuntu0.1~esm1"}]}],"versions":["5.2.10+dfsg-1","5.2.14+dfsg-1","5.2.14+dfsg-1build1"]},{"source":"osv","ecosystem":"Ubuntu:Pro:16.04:LTS","package":"libphp-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.2.14+dfsg-1ubuntu0.1~esm1"}]}],"versions":["5.2.10+dfsg-1","5.2.14+dfsg-1","5.2.14+dfsg-1build1"],"bundled":7},{"source":"osv","ecosystem":"Ubuntu:Pro:18.04:LTS","package":"libphp-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.2.14+dfsg-2.3+deb9u2ubuntu0.1~esm1"}]}],"versions":["5.2.14+dfsg-2.3","5.2.14+dfsg-2.3+deb9u1build0.18.04.1","5.2.14+dfsg-2.3+deb9u2build0.18.04.1"],"bundled":7},{"source":"osv","ecosystem":"Ubuntu:Pro:20.04:LTS","package":"libphp-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.0.6-0.1ubuntu0.1~esm1"}]}],"versions":["6.0.6-0.1"],"bundled":7},{"source":"osv","ecosystem":"Ubuntu:Pro:22.04:LTS","package":"libphp-phpmailer","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.2.0-2ubuntu0.1~esm1"}]}],"versions":["6.2.0-2"],"bundled":7}],"products":[{"vendor":"phpmailer_project","product":"phpmailer"}],"references":[{"url":"http://www.securityfocus.com/bid/95328","tags":["vdb-entry","x_refsource_BID","x_transferred","Third Party Advisory","VDB Entry","advisory","web"]},{"url":"http://kalilinux.co/2017/01/12/phpmailer-cve-2017-5223-local-information-disclosure-vulnerability-analysis/","tags":["x_refsource_MISC","x_transferred","Exploit","Third Party Advisory","evidence","web","report"]},{"url":"https://www.exploit-db.com/exploits/43056/","tags":["exploit","x_refsource_EXPLOIT-DB","x_transferred","web"]},{"url":"https://github.com/PHPMailer/PHPMailer/blob/master/SECURITY.md","tags":["x_refsource_MISC","x_transferred","Issue Tracking","Patch","Third Party Advisory","fix","web","report"]},{"url":"https://github.com/PHPMailer/PHPMailer/security/advisories/GHSA-4x5h-cr29-fhp6","tags":["web"]},{"url":"https://github.com/FriendsOfPHP/security-advisories/blob/master/phpmailer/phpmailer/CVE-2017-5223.yaml","tags":["web"]},{"url":"https://github.com/PHPMailer/PHPMailer/releases/tag/v5.2.22","tags":["web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2017-5223","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-4x5h-cr29-fhp6"},{"url":"https://security-tracker.debian.org/tracker/CVE-2017-5223","tags":["advisory"]},{"url":"https://www.exploit-db.com/exploits/43056","tags":["web"]},{"url":"http://kalilinux.co/2017/01/12/phpmailer-cve-2017-5223-local-information-disclosure-vulnerability-analysis","tags":["web"]},{"url":"https://advisories.mageia.org/MGASA-2017-0022.html","tags":["advisory"]},{"url":"https://bugs.mageia.org/show_bug.cgi?id=20069","tags":["report"]},{"url":"https://www.debian.org/security/2016/dsa-3750","tags":["web"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/thread/JTXZSKTKOWTVEXDS76R6GJGI3MLA2LL5/","tags":["web"]},{"url":"https://ubuntu.com/security/CVE-2017-5223","tags":["report"]},{"url":"https://ubuntu.com/security/notices/USN-5956-1","tags":["advisory"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2017-5223","tags":["report"]},{"url":"https://ubuntu.com/security/CVE-2016-10033","tags":["report"]},{"url":"https://ubuntu.com/security/CVE-2016-10045","tags":["report"]},{"url":"https://ubuntu.com/security/CVE-2017-11503","tags":["report"]},{"url":"https://ubuntu.com/security/CVE-2018-19296","tags":["report"]},{"url":"https://ubuntu.com/security/CVE-2020-13625","tags":["report"]},{"url":"https://ubuntu.com/security/CVE-2021-3603","tags":["report"]}],"sources":{"cve":[{"id":"CVE-2017-5223","description":"An issue was discovered in PHPMailer before 5.2.22. PHPMailer's msgHTML method applies transformations to an HTML document to make it usable as an email message body. One of the transformations is to convert relative image URLs into attachments using a script-provided base directory. If no base directory is provided, it resolves to /, meaning that relative image URLs get treated as absolute local file paths and added as attachments. To form a remote vulnerability, the msgHTML method must be called, passed an unfiltered, user-supplied HTML document, and must not set a base directory.","status":"published","published":"2017-01-16T06:00:00Z","modified":"2024-08-05T14:55:35.461Z","updated_at":"2026-11-02T14:33:12.599234Z"}],"euvd":[{"id":"EUVD-2020-0329","description":"An issue was discovered in PHPMailer before 5.2.22. PHPMailer's msgHTML method applies transformations to an HTML document to make it usable as an email message body. One of the transformations is to convert relative image URLs into attachments using a script-provided base directory. If no base directory is provided, it resolves to /, meaning that relative image URLs get treated as absolute local file paths and added as attachments. To form a remote vulnerability, the msgHTML method must be called, passed an unfiltered, user-supplied HTML document, and must not set a base directory.","status":"published","published":"2017-01-16T06:00:00Z","modified":"2024-08-05T14:55:35Z","updated_at":"2026-11-03T02:39:15.955222Z"}],"ghsa":[{"id":"GHSA-4x5h-cr29-fhp6","title":"Local file disclosure in PHPMailer","description":"An issue was discovered in PHPMailer before 5.2.22. PHPMailer\u0026#39;s `msgHTML` method applies transformations to an HTML document to make it usable as an email message body. One of the transformations is to convert relative image URLs into attachments using a script-provided base directory. If no base directory is provided, it resolves to `/`, meaning that relative image URLs get treated as absolute local file paths and added as attachments. To form a remote vulnerability, the msgHTML method must be called, passed an unfiltered, user-supplied HTML document, and must not set a base directory.\n\n### Impact\nArbitrary local files can be attached to email messages.\n\n### Patches\nFixed in 5.2.22\n\n### Workarounds\nValidate input before using user-supplied file paths.\n\n### References\nhttps://nvd.nist.gov/vuln/detail/CVE-2017-5223\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open a private issue in [the PHPMailer project](https://github.com/PHPMailer/PHPMailer)","status":"published","published":"2020-03-05T22:09:10Z","modified":"2023-01-09T05:02:28Z","cvss":[{"version":"3.0","score":5.5,"vector":"CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","level":"medium"}],"cwes":["CWE-200"],"updated_at":"2026-11-02T14:36:03.040255Z"}],"nvd":[{"id":"CVE-2017-5223","description":"An issue was discovered in PHPMailer before 5.2.22. PHPMailer's msgHTML method applies transformations to an HTML document to make it usable as an email message body. One of the transformations is to convert relative image URLs into attachments using a script-provided base directory. If no base directory is provided, it resolves to /, meaning that relative image URLs get treated as absolute local file paths and added as attachments. To form a remote vulnerability, the msgHTML method must be called, passed an unfiltered, user-supplied HTML document, and must not set a base directory.","status":"published","published":"2017-01-16T06:59:00.197Z","modified":"2026-06-17T01:20:11.617Z","cvss":[{"version":"3.0","score":5.5,"vector":"CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","level":"medium","assessor":"primary"},{"version":"2.0","score":2.1,"vector":"AV:L/AC:L/Au:N/C:P/I:N/A:N","level":"low","assessor":"primary"}],"cwes":["CWE-200"],"updated_at":"2026-11-02T14:03:42.372487Z"}],"osv":[{"id":"CVE-2017-5223","description":"An issue was discovered in PHPMailer before 5.2.22. PHPMailer's msgHTML method applies transformations to an HTML document to make it usable as an email message body. One of the transformations is to convert relative image URLs into attachments using a script-provided base directory. If no base directory is provided, it resolves to /, meaning that relative image URLs get treated as absolute local file paths and added as attachments. To form a remote vulnerability, the msgHTML method must be called, passed an unfiltered, user-supplied HTML document, and must not set a base directory.","status":"published","published":"2017-01-16T06:59:00.197Z","modified":"2026-10-20T10:48:28.174082801Z","cvss":[{"version":"3.0","score":5.5,"vector":"CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","level":"medium"}],"updated_at":"2026-11-02T15:44:06.029968Z"},{"id":"DEBIAN-CVE-2017-5223","description":"An issue was discovered in PHPMailer before 5.2.22. PHPMailer's msgHTML method applies transformations to an HTML document to make it usable as an email message body. One of the transformations is to convert relative image URLs into attachments using a script-provided base directory. If no base directory is provided, it resolves to /, meaning that relative image URLs get treated as absolute local file paths and added as attachments. To form a remote vulnerability, the msgHTML method must be called, passed an unfiltered, user-supplied HTML document, and must not set a base directory.","status":"published","published":"2017-01-16T06:59:00.197Z","modified":"2026-09-01T20:03:48.033774428Z","cvss":[{"version":"3.0","score":5.5,"vector":"CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","level":"medium"}],"updated_at":"2026-11-02T15:45:29.100767Z"},{"id":"GHSA-4x5h-cr29-fhp6","title":"Local file disclosure in PHPMailer","description":"An issue was discovered in PHPMailer before 5.2.22. PHPMailer\u0026#39;s `msgHTML` method applies transformations to an HTML document to make it usable as an email message body. One of the transformations is to convert relative image URLs into attachments using a script-provided base directory. If no base directory is provided, it resolves to `/`, meaning that relative image URLs get treated as absolute local file paths and added as attachments. To form a remote vulnerability, the msgHTML method must be called, passed an unfiltered, user-supplied HTML document, and must not set a base directory.\n\n### Impact\nArbitrary local files can be attached to email messages.\n\n### Patches\nFixed in 5.2.22\n\n### Workarounds\nValidate input before using user-supplied file paths.\n\n### References\nhttps://nvd.nist.gov/vuln/detail/CVE-2017-5223\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open a private issue in [the PHPMailer project](https://github.com/PHPMailer/PHPMailer)","status":"published","published":"2020-03-05T22:09:10Z","modified":"2024-02-16T08:12:47.349553Z","cvss":[{"version":"3.0","score":5.5,"vector":"CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","level":"medium"}],"cwes":["CWE-200"],"updated_at":"2026-11-02T15:46:37.528068Z"},{"id":"UBUNTU-CVE-2017-5223","description":"An issue was discovered in PHPMailer before 5.2.22. PHPMailer's msgHTML method applies transformations to an HTML document to make it usable as an email message body. One of the transformations is to convert relative image URLs into attachments using a script-provided base directory. If no base directory is provided, it resolves to /, meaning that relative image URLs get treated as absolute local file paths and added as attachments. To form a remote vulnerability, the msgHTML method must be called, passed an unfiltered, user-supplied HTML document, and must not set a base directory.","status":"published","published":"2017-01-16T06:59:00Z","modified":"2026-02-04T04:22:32.25534Z","cvss":[{"version":"3.0","score":5.5,"vector":"CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","level":"medium"}],"updated_at":"2026-11-02T15:54:15.388065Z"},{"id":"DLA-1591-1","title":"libphp-phpmailer - security update","status":"published","published":"2018-11-23T00:00:00Z","modified":"2026-03-09T01:00:55.641302Z","updated_at":"2026-11-02T15:46:09.777694Z"},{"id":"DLA-817-1","title":"libphp-phpmailer - security update","status":"published","published":"2017-02-06T00:00:00Z","modified":"2026-03-09T02:11:11.006641Z","updated_at":"2026-11-02T15:46:13.207219Z"},{"id":"MGASA-2017-0022","title":"Updated php-phpmailer packages fix security vulnerabilities","description":"It was discovered that PHPMailer, a popular library to send email from\nPHP applications, allowed a remote attacker to execute code if they were\nable to provide a crafted Sender address (CVE-2016-10033).\n\nIt was discovered that PHPMailer prior to 5.2.22 contained a local file\ndisclosure vulnerability if content passed to `msgHTML()` was sourced\nfrom unfiltered user input (CVE-2017-5223).\n","status":"published","published":"2017-01-27T09:19:09Z","modified":"2026-04-16T06:25:22.147379297Z","updated_at":"2026-11-02T15:49:40.103088Z"},{"id":"USN-5956-1","title":"libphp-phpmailer vulnerabilities","description":"Dawid Golunski discovered that PHPMailer was not properly escaping user\ninput data used as arguments to functions executed by the system shell. An\nattacker could possibly use this issue to execute arbitrary code. This\nissue only affected Ubuntu 16.04 ESM. (CVE-2016-10033, CVE-2016-10045)\n\nIt was discovered that PHPMailer was not properly escaping characters\nin certain fields of the code_generator.php example code. An attacker\ncould possibly use this issue to conduct cross-site scripting (XSS)\nattacks. This issue was only fixed in Ubuntu 16.04 ESM and Ubuntu 18.04\nESM. (CVE-2017-11503)\n\nYongxiang Li discovered that PHPMailer was not properly converting\nrelative paths provided as user input when adding attachments to messages,\nwhich could lead to relative image URLs being treated as absolute local\nfile paths and added as attachments. An attacker could possibly use this\nissue to access unauthorized resources and expose sensitive information.\nThis issue only affected Ubuntu 16.04 ESM. (CVE-2017-5223)\n\nSehun Oh discovered that PHPMailer was not properly processing untrusted\nnon-local file attachments, which could lead to an object injection. An\nattacker could possibly use this issue to execute arbitrary code. This\nissue only affected Ubuntu 16.04 ESM. (CVE-2018-19296)\n\nElar Lang discovered that PHPMailer was not properly escaping file\nattachment names, which could lead to a misinterpretation of file types\nby entities processing the message. An attacker could possibly use this\nissue to bypass attachment filters. This issue was only fixed in Ubuntu\n16.04 ESM and Ubuntu 20.04 ESM. (CVE-2020-13625)\n\nIt was discovered that PHPMailer was not properly handling callables in\nits validateAddress function, which could result in untrusted code being\ncalled should the global namespace contain a function called 'php'. An\nattacker could possibly use this issue to execute arbitrary code. This\nissue was only fixed in Ubuntu 20.04 ESM and Ubuntu 22.04 ESM.\n(CVE-2021-3603)\n","status":"published","published":"2023-03-15T14:33:12Z","modified":"2026-06-25T13:31:53.33751944Z","updated_at":"2026-11-02T16:58:16.738762Z"}]}}
