archonproject/archon

XSS Vulnerability

paurkedal opened this issue · 2 comments

Archon substitutes unescaped query strings into HTML at various places, making it vulnerable to cross-site scripting attacks. We found out through https://www.openbugbounty.org/incidents/202333/, which, if hope to have fixed the following, though a fgrep '\"$' -r * --include \*.php suggests there may be more cases.

--- packages/core/pub/contact.php       2017-02-23 18:00:19.289374542 +0100
+++ packages/core/pub/contact.php.orig  2014-01-17 21:24:06.000000000 +0100
@@ -67,7 +67,7 @@
 
     $in_referer = $_REQUEST['referer'] ? $_REQUEST['referer'] : urlencode($_REQUEST['HTTP_REFERER']);
 
-    $repositoryid = $_REQUEST['repositoryid'] ? int($_REQUEST['repositoryid']) : 0;
+    $repositoryid = $_REQUEST['repositoryid'] ? $_REQUEST['repositoryid'] : 0;
 
 
 
@@ -111,8 +111,8 @@
 
        $form = "<input type=\"hidden\" name=\"f\" value=\"sendemail\" />\n";
        $form .= "<input type=\"hidden\" name=\"p\" value=\"core/contact\" />\n";
-       $form .= "<input type=\"hidden\" name=\"referer\" value=\"".htmlspecialchars($in_referer)."\" />\n";
-       $form .= "<input type=\"hidden\" name=\"query_string\" value=\"".htmlspecialchars($query_string)."\" />\n";
+       $form .= "<input type=\"hidden\" name=\"referer\" value=\"$in_referer\" />\n";
+       $form .= "<input type=\"hidden\" name=\"query_string\" value=\"$query_string\" />\n";
        $form .= "<input type=\"hidden\" name=\"RepositoryID\" value=\"$repositoryid\" />\n";
 
        $strRequiredMarker = "<span style=\"color:red\">*</span>";

Good to hear, and thanks for the pointer. I opened LibraryHost#7.

Hope you're well too!