Preventing Log Forging in Liferay 6.2Created: 28 January 2016 Modified:
In the process of securing our customized deployment of Liferay 6.2 scanning revealed that we have a vulnerability to Log Forging. Log Forging is where an attacker inserts information into a log file. This information could for example say that an event happened which didn’t. The most obvious avenue of attack is user input which is written to a log file. The attacker could simply put data in a form field that looks like a log entry.
The currently accepted solution is to remove any line feeds and carriage returns from text written to a log file. If you are using an HTML log view you will also want to html encode any text written to the log file. Specifically any text than comes from an external source, such as a user.
Fortunately Liferay 6.2 has a solution for this out of the box. It is tucked away inside the system.properties file. To enable it you simply need to modify your JVM startup parameters. In Tomcat you would modify the setenv.sh file to look something like the following.
You enable sanitization, define a replacement character and create a white list of acceptable characters.tags: liferay - java - log - forging - log forging