Page MenuHomePhabricator

Disable XML entity loader by default in libphutil
ClosedPublic

Authored by epriestley on Jan 23 2014, 9:32 PM.
Tags
None
Referenced Files
F18839326: D8049.id.diff
Mon, Oct 27, 3:38 PM
F18835167: D8049.diff
Sun, Oct 26, 1:57 PM
F18789172: D8049.id18207.diff
Wed, Oct 15, 8:23 AM
F18765628: D8049.diff
Tue, Oct 7, 12:15 PM
F18645562: D8049.id18207.diff
Sep 19 2025, 8:05 AM
F18640120: D8049.id.diff
Sep 17 2025, 3:42 PM
F18631001: D8049.diff
Sep 16 2025, 1:53 PM
F18622899: D8049.diff
Sep 15 2025, 1:27 PM
Subscribers

Details

Summary

See https://www.facebook.com/BugBounty/posts/778897822124446 and http://www.ubercomp.com/posts/2014-01-16_facebook_remote_code_execution.

By default, SimpleXMLElement will pretty much just run whatever code you want when handed a specially crafted document. We currently load XML only from trusted (S3, EC2, git/svn/hg) or local sources (unit test runners) so there are no concrete vulnerabilities in Phabricator, but this behavior is incredibly dangerous, surprising, and highly undesirable.

Test Plan

There's an example of a document which does bad things on http://www.php.net/manual/en/function.libxml-disable-entity-loader.php. I verified that SimpleXMLElement reads /etc/passwd when handed this document, then applied the fix. It no longer reads arbitrary files off disk.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped