Skip to content

Commit bbc2526

Browse files
committed
SECURITY: Enforce redirect to login page
Thanks to Ian Walls for reporting this issue. NOTE: This affects all modules, not just the Resources module. From his report: The ajax scripts (ajax_htmldata.php and ajax_processing.php) are not authenticated. Thus, as a malicious user on the open internet with only the domain name and path of a CORAL install, I can not only read usernames and passwords for database platforms (if added by the institution), but also delete resources from the database and run arbitrary code. Examples: * Read accounts: curl 'http://coraldemo.library.tamu.edu/resources/ajax_htmldata.php?action=getAccountDetails&resourceID=27' * Delete a resource: curl 'http://coraldemo.library.tamu.edu/resources/ajax_processing.php?action=deleteResource&resourceID=27' * Upload a malicious script: curl 'http://coraldemo.library.tamu.edu/resources/ajax_processing.php?action=uploadAttachment' -H 'Content-Type: multipart/form-data' -F 'myfile=@/home/user/Desktop/myevilscript.php' This commit simply causes the script to exit after attempting to forward to the login page, to prevent any further data from being sent to disobedient browsers (such as curl). A patch file is also included. Signed-off-by: Remington Steed <rjs7@calvin.edu>
1 parent 7ea2173 commit bbc2526

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diff --git a/user.php b/user.php
2+
index ef68901..1fe9e83 100755
3+
--- a/user.php
4+
+++ b/user.php
5+
@@ -57,6 +57,8 @@ if ($config->settings->authModule == 'Y'){
6+
$authURL = $util->getCORALURL() . "auth/" . $addURL . htmlentities($_SERVER['REQUEST_URI']);
7+
header('Location: ' . $authURL, true);
8+
9+
+ exit; //PREVENT SECURITY HOLE
10+
+
11+
}
12+
13+
14+
@@ -110,6 +112,7 @@ if ($loginID){
15+
//if the user doesn't exist in database we need to redirect them to a page to give instructions on how to be added
16+
if ($user->privilegeID == ""){
17+
header('Location: not_avail.php');
18+
+ exit; //PREVENT SECURITY HOLE
19+
}
20+
}
21+

user.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
$authURL = $util->getCORALURL() . "auth/" . $addURL . htmlentities($_SERVER['REQUEST_URI']);
5858
header('Location: ' . $authURL, true);
5959

60+
exit; //PREVENT SECURITY HOLE
61+
6062
}
6163

6264

@@ -110,6 +112,7 @@
110112
//if the user doesn't exist in database we need to redirect them to a page to give instructions on how to be added
111113
if ($user->privilegeID == ""){
112114
header('Location: not_avail.php');
115+
exit; //PREVENT SECURITY HOLE
113116
}
114117
}
115118

0 commit comments

Comments
 (0)