[SK쉴더스 Rookies 19기] 클라우드 기반 스마트 융합보안 과정
[case7]
public static void main(String args[]) throws IOException {
List<String> allowedCommands = new ArrayList<String>();
allowedCommands.add("notepad");
allowedCommands.add("calc");
String cmd = args[0];
if (!allowedCommands.contains(cmd)) {
System.err.println("Error");
return;
}
Process ps = null;
try {
ps = Runtime.getRuntime().exec(cmd);
......
취약점 | Command Injection |
양호/취약 | 양호 |
사유 | 화이트리스트 기반 응용프로그램 종류 필터링을 정의하고 있기 때문 |
[case8]
string file = Request.QueryString["path"];
if (file != null)
{
if (file.IndexOf('\\') > -1 || file.IndexOf('/') > -1)
{
Response.Write("Path Traversal Attack");
}
else
{
File.Delete(file);
}
}
취약점 | 경로 순회 공격(Directory Traversal) / 경로 조작 및 자원 삽입 |
양호/취약 | 양호 |
사유 | /와 \\를 검증하고 있기 때문 |
[case9]
<%
String param = request.getParameter(“param”);
If(param != null) {
param = param.replaceAll(“<script>”,””);
param = param.replaceAll(“</script>”,””);
}
%>
…
<p> 제목 : <%=param%></p>
취약점 | XSS, CSRF |
양호/취약 | 취약 |
사유 | 공격을 방어하기 위한 충분한 키워드 필터링이 적용되지 않았기 때문 |
[case10]
<%@taglibprefix=”c”url=”http://java.sun.com/jsp/jstl/core”%>
<%@tagliburi=”http://java.sun.com/jsp/jstl/functions”prefix=”fn”%>
…
<c:out value=”${param.name}” escapeXml=”false”/>
취약점 | XSS |
양호/취약 | 취약 |
사유 | escapeXml="false"로 설정하여 특수문자가 이스케이프되지 않고 그대로 출력되기 때문 |
728x90
'Rookies > 클라우드 기반 취약점 진단 및 대응 실무' 카테고리의 다른 글
[SK shieldus Rookies 19기] 소스코드 진단 02 (0) | 2024.05.17 |
---|---|
[SK shieldus Rookies 19기] 소스코드 진단 01 (0) | 2024.05.17 |
[SK shieldus Rookies 19기] 12 - 인증 우회 2 (Burp Suite Academy) (0) | 2024.05.17 |
[SK shieldus Rookies 19기] 11 - 인증 우회 (Burp Suite Academy) (0) | 2024.05.16 |
[SK shieldus Rookies 19기] 10 - Directory Traversal URL-decode (Burp Suite Academy) (0) | 2024.05.15 |