
CCronemberger166191 (Community Member) asked a question.
ESAPI is not being actively maintained for a long time.

CCronemberger166191 (Community Member) asked a question.
ESAPI is not being actively maintained for a long time.
Ask the Community
Get answers, share a use case, discuss your favorite features, or get input from the community.
By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts.
.png)
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising.
Great question, the ESAPI library is a non-active OWASP project. There's many ways to remediate this flaw, and the code to remediate is very straight forward. You'll want to strip out Carriage Return(\r) Line Feeds(\n) characters from the dynamic data before logging it. Also, if you are planning on using a web-based log viewer, you will want to HTMLEncode() the data before logging.
I would be remiss as the ESAPI-Java co-lead to let this comment alone. (I need to get out more...)
This past June we pushed out a major bugfix release for version 2.2.0.0
https://github.com/ESAPI/esapi-java-legacy/blob/esapi-2.2.0.0/documentation/esapi4java-core-2.2.0.0-release-notes.txt
Why did it take so long between 2016 and 2019 to push out a release? In short, it's being maintained by 2.5 volunteers. (.5 makes amazing contributions but he's busy... so...) but also that there was some difficulty in tracking down the prior contributor that had the release instructions and Java signing key. Absolutely not sure why we couldn't have just generated a new key, but it goes to show that you should never have one key to the castle!
I wanted to draw your attention to this:
"ESAPI 2.1.0.1 release: 177 Java source files 1547 Junit tests in 88 Java source files ESAPI 2.2.0.0 release: 194 Java source files 4150 JUnit tests in 118 Java source files"
We're limping, but we're not dead!
Hi Justin
Is that true with the latest version of Veracode?? cause at least half year ago i was stuck with ESAPI as the only way to avoid the CWE-117 report. I tried simply replacing \r and \n through a utility method or inline, nothing worked for me. Is like Veracode just looks if you use ESAPI, if you don't, its a flaw. these days, even some newer logging mechanism (log4j2) can be configured to avoid log forging
We set up log4j2 (v2.7) with %encode as OWASP recommends (https://www.owasp.org/index.php/Injection_Prevention_Cheat_Sheet_in_Java#Log_Injection). It does HTML encoding and CRLF replacement. Ran a scan against our jar and CWE-117 still comes up. Is it correct that we have to mitigate this even though per Justin above this is an expected and proper remediation?
Thanks.
Hi,
Is the lib https://github.com/javabeanz/owasp-security-logging fix it?
Hi @Qtran106484 (Community Member) , @JMaloney925304 (Community Member) , @EVelázquez833798 (Community Member) - thank you all for the follow-up questions! I have connected with @Justin Yao (Veracode, Inc.) , who is doing researching to give you a more comprehensive response to this topic. Please stay tuned for more details as Justin completes the research.
Thank you for your patience. The Veracode system is designed to look for a few different solutions for remediating CRLF Injection in Logs(CWE117).
ESAPI Library is a legacy option used by older applications, and it is recognized by the Veracode system.
There's a list of supported cleansers that have been reviewed by our Research team that can be used inline when logging data external to the application. The list can be found in our help center at the following link.
Supported Cleansers
https://help.veracode.com/reader/4EKhlLSMHm5jC8P8j3XccQ/IiF_rOE79ANbwnZwreSPGA
@EVelázquez833798 (Community Member) You can create your own helper function to strip out the offending characters, but it will have to be reviewed and approved through the mitigation workflow by your security team. This is true for any custom written cleansing functions, because it requires security review for completeness/correctness.
@JMaloney925304 (Community Member) The usage of Log4j2 can be a possible remediation, but it will also have to be reviewed and approved through the mitigation workflow by your security team and server administration team. This remediation approach relies on runtime classpath loading the log4j configuration file as such this is not something which can be confirmed via binary analysis.
@Qtran106484 (Community Member) The OWASP Security Logging Library is a potential remediation approach, where you need to use the utility function. The alternate approach with this library is to use it with Logback Framework. Either way the use of this library would require you to document a mitigation proposal in the Veracode Platform for approval by your security team.
Primarily this library is used to add some consistency for logging security events, and some masking for possibly sensitive details.
CRLF Utility Method replaceCRLFWithUnderscore()
https://github.com/javabeanz/owasp-security-logging/blob/master/owasp-security-logging-common/src/main/java/org/owasp/security/logging/Utils.java
Logback and OWASP Security Logging Library
https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Injection_Prevention_Cheat_Sheet_in_Java.md#example-using-logback-with-the-owasp-security-logging-library
Hi,
we have similar issue and we are using logback LogstashEncoder which converts every log message into JSON which is then passed into logstash. Currently veracode is reporting issue CWE 117, but I think that this issue is mitigated by library(logback) itself. Is there some way how to configure veracode so it ignores globally on whole project this issue? Because currently every time we add new logging statement we have to go to veracode and manually mitigate this issue with comment.
Thanks.
Hi @JJečmínek184882 (Community Member) ,
JSON does not use CR (\r) or LF (\n) as a separator so this component of your architecture should not be vulnerable to injection. However if these statements are later printed in a file that does rely on these characters as as separators your application may still be vulnerable.
If you have verified that your application does not use line delimited files anywhere you can choose to mitigate these flaws: https://docs.veracode.com/r/c_mitigation_performance_review
You can have these mitigations automatically proposed for you (and optionally automatically accepted) if you are using a Custom Cleanser Annotation: https://docs.veracode.com/r/c_frameworks.
Please note that your security team must enable this in the Veracode Platform. Please contact them before using this feature.
Alternatively, you can contact your security and investigate the option of removing this flaw category from your policy compliance
Please let me know if you have any remaining questions or concerns.
Thank you,
Boy Baukema
Thank you for the answer, I have also contacted creators of logstash-logback library and they confirmed that logstash-logback is not vulnerable to CWE-117, detailed answer is here https://github.com/logstash/logstash-logback-encoder/issues/331