My Boundary As Much As I Experienced

시큐어 코딩 본문

Computer Basics/Security

시큐어 코딩

Bumang 2023. 10. 17. 09:01

시큐어 코딩

안전한 소프트웨어를 개발하기 위해, 소스코드 등에 존재할 수 있는 잠재적인 보안약점을 제거하는 것

 

 

보안 약점을 노려 발생하는 사고사례들

  • SQL 인젝션 취약점으로 개인유출 사고 발생
    • 인증함수(입력값)
    • 입력값으로 "truthy) //주석" 같은걸 주면  인증함수(truthy) //주석) ... 로 되어
    • 나머지 코드는 주석처리되어 뚫린다고 합니다.
  • URL 파라미터 조작 개인정보 노출
    • URL파라미터에 중요한 개인정보 등이 있을 때 이를 유추하여 빼오는 기술 
  • 무작위 대입공격 기프트카드 정보 유출
    • Brute Force로 특정 값 유추해오기

 

 

  • 안전하지 않은 코드
String query "SELECT * FROM users WHERE userid = '" + userid + "'" + "AND password = '" + password + "'";

Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(query);

 

  • 안전한 코드
String query "SELECT * FROM users WHERE userid = ? + "AND password = ?";

PrepareStatement stmt = connection.prepareStatement(query);
stmt.setString(1, userid);
stmt.setString(2, password);
ResultSet rs = stmt.executeQuery();

 

코딩애플 - spl 인젝션

https://www.youtube.com/watch?v=FoZ2cucLiDs

 

시큐어 코딩이란?

http://www.incodom.kr/%EC%8B%9C%ED%81%90%EC%96%B4%EC%BD%94%EB%94%A9%28SecureCoding%29