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
F12179339: D8049.diff
Tue, Sep 12, 12:22 AM
F12178341: D8049.id18207.diff
Mon, Sep 11, 8:44 AM
F12174590: D8049.id18207.diff
Sat, Sep 9, 1:16 PM
F12174589: D8049.id18204.diff
Sat, Sep 9, 1:16 PM
F12174587: D8049.id.diff
Sat, Sep 9, 1:16 PM
F12161774: D8049.diff
Wed, Sep 6, 4:59 PM
F12154568: D8049.diff
Mon, Sep 4, 8:55 AM
F12154411: D8049.diff
Mon, Sep 4, 7:22 AM
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