forked from fnmsd/awvs_script_decode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathliferay.script
More file actions
59 lines (52 loc) · 2.12 KB
/
Copy pathliferay.script
File metadata and controls
59 lines (52 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include helpers.inc;
#include reporting_helpers.inc;
// **************************************************************************************
function alert(uri, vxml, job, matchedText)
{
var ri = new TReportItem();
ri.LoadFromFile(vxml);
ri.affects = uri;
ri.alertPath = "Scripts/" + vxml;
ri.setHttpInfo(job);
addHTTPJobToCrawler(job, 1, 1);
AddReportItem(ri);
}
/***********************************************************************************/
function test_json_api_auth_bypass(dir, uri)
{
//trace(uri);
lastJob = new THTTPJob();
lastJob.verb = "POST";
lastJob.url = dir.url;
if (uri == '/') lastJob.uri = uri + 'tunnel-web/secure/json';
else lastJob.uri = uri + '/tunnel-web/secure/json';
lastJob.request.addHeader("Authorization", "Basic dGVzdEBsaWZlcmF5LmNvbTp0ZXN0", true);
lastJob.request.addHeader('Content-type', 'application/x-www-form-urlencoded', true);
lastJob.request.body = 'serviceClassName=com.liferay.portal.service.UserServiceUtil&serviceMethodName=getUserById&serviceParameters=[userId]&userId=[9999999]';
lastJob.execute();
//trace(lastJob.responseStatus);
if (!lastJob.wasError && !lastJob.notFound)
{
if (lastJob.responseStatus == 200 && lastJob.response.body.indexOf('com.liferay.portal.NoSuchUserException: No User exists with the primary key 9999999') != -1)
{
// successful
alert(lastJob.uri, 'liferay_json_api_auth_bypass.xml', lastJob);
return true;
}
}
return false;
}
/***********************************************************************************/
/* main */
/***********************************************************************************/
var dir = getCurrentDirectory();
if (dir)
{
var alreadyReportedWebApplication = getGlobalValue("detectedAppLiferay");
if (!alreadyReportedWebApplication)
{
setGlobalValue("detectedAppLiferay", 1, true);
KBase("Liferay web application", "Liferay web application was detected in directory [dark][bold]" + dir.fullPath + "[/bold][/dark].");
}
test_json_api_auth_bypass(dir, dir.fullPath);
}