728x90
반응형
로깅 인젝션 공격
Noncompliant Code Example
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
String param1 = req.getParameter("param1");
Logger.info("Param1: " + param1 + " " + Logger.getName()); // Noncompliant
// ...
}
Compliant Solution
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
String param1 = req.getParameter("param1");
// Replace pattern-breaking characters
param1 = param1.replaceAll("[\n\r\t]", "_");
Logger.info("Param1: " + param1 + " " + Logger.getName());
// ...
}
728x90
반응형
'Secure Coding' 카테고리의 다른 글
서블릿 메소드 예외 처리 취약점 (0) | 2021.09.17 |
---|---|
서버측 요청 위조 공격 (0) | 2021.09.17 |
HTTP 응답 헤더 인젝션 (0) | 2021.09.17 |
OS 명령 삽입 공격 (0) | 2021.09.17 |
XPath 인젝션 공격 (0) | 2021.09.17 |
댓글