Page MenuHomePhabricator

DOMDocument::loadHTML() should be called more securely
Closed, ResolvedPublic

Description

The file includes/PF_AutoeditAPI.php calls DOMDocument::loadHTML() in a possibly-unsafe way. That call should be modified using these guidelines:

https://www.mediawiki.org/wiki/XML_External_Entity_Processing

Event Timeline

Change 342439 had a related patch set uploaded (by Harjotsingh):
[mediawiki/extensions/PageForms] Secure call to DOMDocument::loadHTML()

https://gerrit.wikimedia.org/r/342439

@Harjotsingh - this seems reasonable. Did you test this? If so, how?

@Yaron_Koren no, I didn't test for XXE vulnerability.I just followed the prevention pattern specified https://www.mediawiki.org/wiki/XML_External_Entity_Processing.

Is there a way I could test for the vulnerability ?

I don't know how to test for the vulnerability either - though that would be ideal. But the most important thing is just to make sure that the code still works now.

I only tested autoedit for modifying pages automatically as specified here : https://www.mediawiki.org/wiki/Extension:Page_Forms/Linking_to_forms

Change 342439 merged by jenkins-bot:
[mediawiki/extensions/PageForms] Secure call to DOMDocument::loadHTML()

https://gerrit.wikimedia.org/r/342439

Sorry for the long delay. I just merged in your fix. Thank you!