Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions addOns/ascanrules/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed
- Address potential false positives with the XSLT Injection scan rule when payloads cause a failure which may still contain the expected evidence.
- Depends on an updated version of the Common Library add-on.
- Reduced usage of error level logging.

## [74] - 2025-09-18
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void scan(HttpMessage msg, String param, String value) {
} catch (URIException e) {
LOGGER.debug("Failed to send HTTP message, cause: {}", e.getMessage());
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
LOGGER.debug(e.getMessage(), e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import static org.zaproxy.zap.extension.ascanrules.utils.Constants.NULL_BYTE_CHARACTER;

import java.io.IOException;
import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -258,8 +259,8 @@ private List<HtmlContext> performAttack(
// Not an error, just means we probably attacked the redirect
// location
return null;
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
} catch (IOException e) {
LOGGER.debug(e.getMessage(), e);
}

if (isStop()) {
Expand Down Expand Up @@ -996,8 +997,8 @@ public void scan(HttpMessage msg, String param, String value) {
attackHeader(msg, param, appendedValue ? value : "");
}

} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
} catch (IOException e) {
LOGGER.debug(e.getMessage(), e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ && isPage200(verificationMsg)) {
} catch (URIException e) {
LOGGER.debug("Failed to send HTTP message, cause: {}", e.getMessage());
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
LOGGER.debug(e.getMessage(), e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1042,9 +1042,9 @@ public void scan() {
if (os != null) os.close();
}
}
} catch (Exception e) {
} catch (IOException e) {
// needed to catch exceptions from the "finally" statement
LOGGER.error("Error scanning a node for HeartBleed: {}", e.getMessage(), e);
LOGGER.debug("Error scanning a node for HeartBleed: {}", e.getMessage(), e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,13 +409,13 @@ private static List<String> getOptionalList(JSONObject jsonObj, String key) {
private String readPayloadsFile(String path) {
File f = new File(path);
if (!f.exists()) {
LOGGER.error("No such file: {}", f.getAbsolutePath());
LOGGER.warn("No such file: {}", f.getAbsolutePath());
return "";
}
try {
return new String(Files.readAllBytes(f.toPath()), StandardCharsets.UTF_8);
} catch (IOException e) {
LOGGER.error(
LOGGER.warn(
"Error on opening/reading {} payload file. Error: {}",
getName(),
e.getMessage(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void scan(HttpMessage msg, String param, String value) {
scanWithPayloads(param, ATTACK_PATTERNS_CVE44228, PREFIX_CVE44228);
scanWithPayloads(param, ATTACK_PATTERNS_CVE45046, PREFIX_CVE45046);
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
LOGGER.warn(e.getMessage(), e);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OAST

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
package org.zaproxy.zap.extension.ascanrules;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -95,8 +96,8 @@ public void scan(HttpMessage msg, String param, String value) {
this.setParameter(msg1, param, SourceSinkUtils.getUniqueValue(msg1, param));
LOGGER.debug("Prime msg={} param={}", msg1.getRequestHeader().getURI(), param);
sendAndReceive(msg1, false);
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
} catch (IOException e) {
LOGGER.debug(e.getMessage(), e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
package org.zaproxy.zap.extension.ascanrules;

import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
Expand Down Expand Up @@ -146,8 +147,8 @@ private List<HtmlContext> performAttack(
setParameter(sourceMsg2, param, attack);
try {
sendAndReceive(sourceMsg2);
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
} catch (IOException e) {
LOGGER.debug(e.getMessage(), e);
}

if (isStop()) {
Expand All @@ -157,8 +158,8 @@ private List<HtmlContext> performAttack(
HttpMessage sinkMsg2 = sinkMsg.cloneRequest();
try {
sendAndReceive(sinkMsg2);
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
} catch (IOException e) {
LOGGER.debug(e.getMessage(), e);
}

if (isStop()) {
Expand Down Expand Up @@ -690,8 +691,8 @@ public void scan(HttpMessage sourceMsg, String param, String value) {
}
}
}
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
} catch (IOException e) {
LOGGER.debug(e.getMessage(), e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
package org.zaproxy.zap.extension.ascanrules;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -102,8 +103,8 @@ public void scan() {
sendAndReceive(msg1, false);
SourceSinkUtils.testForSink(msg1);

} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
} catch (IOException e) {
LOGGER.debug(e.getMessage(), e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
package org.zaproxy.zap.extension.ascanrules;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -178,8 +179,8 @@ private boolean scan(URI originalURI, URI attackURI, String payload) {
buildAlert(payload, responseBody).setMessage(attackmsg).raise();
return true;
}
} catch (Exception e) {
LOGGER.error(
} catch (IOException e) {
LOGGER.debug(
"Error scanning a URL for Remote Code Execution via CVE-2012-1823: {}",
e.getMessage(),
e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
package org.zaproxy.zap.extension.ascanrules;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -184,8 +185,8 @@ public void scan() {
buildAlert(sourceCode).setMessage(attackmsg).raise();
}
}
} catch (Exception e) {
LOGGER.error(
} catch (IOException e) {
LOGGER.debug(
"Error scanning a Host for Source Code Disclosure via CVE-2012-1823: {}",
e.getMessage(),
e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.strobel.decompiler.PlainTextOutput;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -267,8 +268,8 @@ public void scan() {
javaClassesFound.remove(classname);
javaClassesHandled.add(classname);
}
} catch (Exception e) {
LOGGER.error(
} catch (IOException e) {
LOGGER.debug(
"Error scanning a Host for Source Code Disclosure via the WEB-INF folder: {}",
e.getMessage(),
e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,11 @@ private void sendPayloadsToMakeCallBack(String paramName, String[] commandExecPa
ex.getMessage(),
msg.getRequestHeader().getURI());
} catch (IOException ex) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exception is also caught just below, shall I remove that catch clause?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

LOGGER.warn(
LOGGER.debug(
"SSTI vulnerability check failed for parameter [{}] and payload [{}] due to an I/O error",
paramName,
payload,
ex);
} catch (Exception ex) {
LOGGER.error("Failed SSTI rule with payload [{}]", payload, ex);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions addOns/ascanrulesAlpha/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed
- The Web Cache Deception scan rule now includes example alert functionality for documentation generation purposes (Issue 6119).
- Depends on an updated version of the Common Library add-on.
- Reduced usage of error level logging.

## [52] - 2025-10-07
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
package org.zaproxy.zap.extension.ascanrulesAlpha;

import java.io.IOException;
import java.net.UnknownHostException;
import java.text.MessageFormat;
import java.util.Collections;
Expand Down Expand Up @@ -547,10 +548,10 @@ public void scan(HttpMessage originalmsg, String paramname, String paramvalue) {

} catch (UnknownHostException | URIException e) {
LOGGER.debug("Failed to send HTTP message, cause: {}", e.getMessage());
} catch (Exception e) {
} catch (IOException e) {
// Do not try to internationalise this.. we need an error message in any event..
// if it's in English, it's still better than not having it at all.
LOGGER.error("An error occurred checking a url for LDAP Injection issues", e);
LOGGER.debug("An error occurred checking a url for LDAP Injection issues", e);
}
}

Expand Down Expand Up @@ -590,11 +591,9 @@ protected boolean responseMatches(HttpMessage msg, Pattern pattern) {
* @param placeboMessage the message used to send the placebo attack
* @param parameterName the name of the parameter which was attacked
* @return
* @throws Exception
*/
private boolean checkResultsForLDAPAlert(
HttpMessage attackMessage, HttpMessage placeboMessage, String parameterName)
throws Exception {
HttpMessage attackMessage, HttpMessage placeboMessage, String parameterName) {
// compare the request response with each of the known error messages,
// for each of the known LDAP implementations.
// in order to minimise false positives, only consider a match
Expand Down
1 change: 1 addition & 0 deletions addOns/ascanrulesBeta/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Changed
- Depends on an updated version of the Common Library add-on.
- Reduced usage of error level logging.

## [62] - 2025-09-18
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
package org.zaproxy.zap.extension.ascanrulesBeta;

import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -392,8 +393,8 @@ public void scan() {
LOGGER.debug(
"The URI has no filename component, so there is not much point in looking for a corresponding backup file!");
}
} catch (Exception e) {
LOGGER.error(
} catch (IOException e) {
LOGGER.debug(
"Error scanning a request for Backup File Disclosure: {}", e.getMessage(), e);
}
}
Expand Down Expand Up @@ -441,7 +442,7 @@ private static boolean isEmptyResponse(byte[] response) {
return response.length == 0;
}

private void findBackupFile(HttpMessage originalMessage) throws Exception {
private void findBackupFile(HttpMessage originalMessage) throws IOException {

try {
boolean gives404s = true;
Expand Down Expand Up @@ -796,8 +797,8 @@ private void findBackupFile(HttpMessage originalMessage) throws Exception {
}
}

} catch (Exception e) {
LOGGER.error(
} catch (IOException e) {
LOGGER.debug(
"Some error occurred when looking for a backup file for '{}'",
originalMessage.getRequestHeader().getURI(),
e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,16 @@ public void scan() {

scanSilverlightCrossdomainPolicyFile(originalURI);

} catch (Exception e) {
// needed to catch exceptions from the "finally" statement
LOGGER.error(
} catch (IOException e) {
LOGGER.debug(
"Error scanning a node for Cross Domain misconfigurations: {}",
e.getMessage(),
e);
} catch (XPathExpressionException xei) {
LOGGER.error(
"Error scanning a node for Cross Domain misconfigurations: {}",
xei.getMessage(),
xei);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public void scan(HttpMessage msg, String paramName, String value) {
} catch (IOException ex) {
// Do not try to internationalise this.. we need an error message in any event..
// if it's in English, it's still better than not having it at all.
LOGGER.error(
LOGGER.debug(
"Expression Language Injection vulnerability check failed for parameter [{}] and payload [{}] due to an I/O error",
paramName,
payload,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.Map;
Expand Down Expand Up @@ -320,7 +321,7 @@ public byte[] getObjectData(
try {
packinfofiledata = getURIResponseBody(uri, false, basemsg);
} catch (FileNotFoundException e) {
LOGGER.error(
LOGGER.warn(
"We could not read '{}' to get the name of the pack file containing the content: {}",
uri,
e.getMessage());
Expand Down Expand Up @@ -1005,8 +1006,8 @@ private byte[] getPackedObjectData(
+ inflatedObjectData.length);

return inflatedObjectData;
} catch (Exception e) {
LOGGER.error("Some error occurred extracting a packed object", e);
} catch (IOException e) {
LOGGER.debug("Some error occurred extracting a packed object", e);
throw e;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public void scan() {
}
return;
} catch (IOException e) {
LOGGER.error("Request couldn't go through:", e);
LOGGER.debug("Request couldn't go through:", e);
return;
}
}
Expand Down
Loading