kraken-ng/Kraken

Error with self.response["key"] while using JSP agent

Closed this issue · 3 comments

[!] CoreException: Traceback (most recent call last):
File "kraken.py", line 51, in
client.do_status()
File "/opt/tools/Kraken/lib/clients/st.py", line 90, in do_status
response = self.httpclient.do_http_request(action)
File "/opt/tools/Kraken/lib/http.py", line 358, in do_http_request
response_data = self.__parse_response(response)
File "/opt/tools/Kraken/lib/http.py", line 339, in __parse_response
raise CoreException(f"response has not data field: '" + self.response["key"] + "'" + "\n" + response.text)
lib.exception.CoreException: response has not data field: 'data'

data=4fbf7b737730726421509921420533436cdd003e3a53c73a4da2428f913906b9cfc16fc59661e151d08973a5cf52a6fd949ac90b38fa8bf3056fc0c79f8e43eb0817796b6910524045e26392e54185824f5aa0794d9c02e2f9e091029f7b48d36bc7b303dd27165b016895c38b7c2f271ba1554a59e166acd7b41e96adec4ac0ba3a19d972f354a4e0c6e0a413b4f8b131d805e71a959fe532b9b168e2e4b8df96a8c7be86e4ca670cf14ef5c70c408a9d1d9f44a6c1b1ee42b365abd2fefa8d298aef855f6529b39220b8c030b0b6671c4e23d827fd1757b444884dc76dc4bf271442bbd9e083f9add09ea76d133a00b2ef96a9d7f869008baaea9785029885ff1e46b22dfed6f6c2a4dc4a2baa3794efd785f4d8b5ce

secu77 commented

Can you provide more information about the environment in which you are deploying the JSP agent?

I'm deploying it in liferay 7.2.0 with tomcat server

secu77 commented

I've seen what was going on. Apparently this line:

response.setContentLength(_output.length());

was causing the HTTP response data to be returned wrong (only in Liferay, because it works fine with Tomcat). I simply removed it because by default the Java web server calculates the content length:

kraken-ng/agents@5ef007a#diff-c3a5ec2517bcce8083bc65fd2fddb1fe39a14425a244dc5c8d1acebd1d7e86d5L410

Please confirm me that this change fixes your bug.