[SK쉴더스 Rookies 19기] 클라우드 기반 스마트 융합보안 과정
[case4]
if (FileUploadCtr.PostedFile.ContentType == "image/jpeg")
{
if (FileUploadCtr.PostedFile.ContentLength < 102400)
{
string fn = Path.GetFileName(FileUploadCtr.FileName);
FileUploadCtr.SaveAs(Server.MapPath("~/") + fn);
StatusLabel.Text = "Upload status: File uploaed!";
}
else
StatusLabel.Text = "Upload Status: The File has to be less than 100 kb!";
}
else
StatusLabel.Text = "Upload Status: Only JPEG files are accepted!";
취약점 | 파일 업로드 (File Upload) |
양호/취약 | 양호 |
사유 | 화이트리스트 기반 파일 타입 검증과 파일 크기 검증 모두 진행하기 때문 |
[case5]
String id = (String)session.getValue("id");
String bn = request.getParameter("gubun");
String rd = request.getParameter("redirect");
if (id.length() > 0) {
String sql = "select level from customer where customer_id = ? ";
conn = db.getConnection();
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, id);
rs = pstmt.executeQuery();
rs.next();
if ("0".equals(rs.getString(1)) && "01AD".equals(bn)) {
response.sendRedirect(rd);
return;
}
취약점 | SQL Injection |
양호/취약 | 양호 |
사유 | PrepareStatement를 사용하며 데이터 바인딩을 통해 동적 쿼리로서 동작되지 않도록 설정하기 때문 |
취약점 | Open Redirect / Reflected XSS |
양호/취약 | 취약 |
사유 | 파라미터 redirect에 대한 검증 부재로 악의적인 사이트로의 리다이렉트 또는 Reflected XSS 가능성이 존재 |
[case6]
String gubun = request.getParameter(“gubun”);
…
String sql = “SELECT * FROM board WHERE b_gubun = ‘”+gubun+ “’”;
Connection con = db.getConnection();
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(sql);
취약점 | SQL Injection |
양호/취약 | 취약 |
사유 | Statement 클래스를 통해 입력 값 gubun을 보호하여 DB 쿼리를 실행하지 않기 때문 |
728x90
'Rookies > 클라우드 기반 취약점 진단 및 대응 실무' 카테고리의 다른 글
[SK shieldus Rookies 19기] 소스코드 진단 03 (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 |