1 / 22

Security Seminar

SPARCS 10 wiki. Security Seminar. Security for who?. Security for… Developers Vulnerabilities in In Web In System Administrators - Wheel 이 되세요 ! System-Level Settings Log Analysis. Vulnerabilities. Web Vulnerabilities SQL Injection Cross-Site Scripting System Vulnerabilities

Download Presentation

Security Seminar

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SPARCS 10 wiki Security Seminar

  2. Security for who? • Security for… • Developers • Vulnerabilities in • In Web • In System • Administrators - Wheel이 되세요! • System-Level Settings • Log Analysis

  3. Vulnerabilities • Web Vulnerabilities • SQL Injection • Cross-Site Scripting • System Vulnerabilities • Stack Overflow • Format String Bug • Heap Overflow

  4. SQL Injection • SQL Query를 조작 • select * from user where ‘id’=‘$id’ and ‘pw’=‘$pw’ • 유저의 id와 pw를 입력 받아서 user라는 table에서 가져오는 코드 • select * from user where ‘id’=‘asdf’ and ‘pw’=‘1234’

  5. SQL Injection • select * from user where ‘id’=‘$id’ and ‘pw’=‘$pw’ • $pw = ‘or 1=1#이라면?

  6. SQL Injection • select * from user where ‘id’=‘asdf’ and ‘pw’=‘’ or 1=1#’ • And가 먼저 연산되고 or가 연산되어서 where문이 항상 true가 됨 • 보통 첫 번째는 admin계정 • 원하는 계정이 아니라면 ’ or 1=1 and id<>나온id#

  7. SQL Injection • Select 1 union select 3 -> 1 3 • Union은 두 쿼리의 결과값을 합쳐준다.

  8. SQL Injection • If(mysql_query(select key from users where id=‘$id’ and password=‘$pw’) == ‘hello’) • $pw = ‘ union select hello# • 원하는 Query 결과를 만들 수 있다.

  9. Solution • 입력 데이터 필터링 • Quotes ‘ • Select • Union • 주석 • SQL-Injection을 미리 방지한 Library 사용

  10. Cross-Site Scripting • 스크립트 삽입이 가능했을때 발생 • 스크립트로 특정 페이지를 강제로 open시켜 쿠키값을 빼낸다 • <img src=“” onload=“”>등 여러 편법이 가능

  11. Stack Overflow • Stack overflow • 가장 기초적인 System Hacking 방법 • Buffer Checking을 하지 않는 프로그램 이용

  12. Setuid bit • rwx 권한과 별개로, 프로그램 실행 도중에 작용하는 권한을 바꿀 수 있다 • Setuid 비트가 되면 그 실행 프로그램의 소유자의 권한으로 작동할 수 있음 • $find / -perm -4000 2>/dev/null

  13. Buffer Overflow • Buffer의 크기 검사를 안하고 값을 쓸 때 발생 • Setuid비트가 걸려있는 프로그램을 공격

  14. Stack Structure

  15. Vulnerable Functions • Strcpy(src,dest) • Src의 값을 dest에 덮는데, 크기 검사를 안함 • Return addr까지 덮일 수 있음

  16. Stack Overflow • Local Variable에 Shellcode의 Opcode를 저장 • Shellcode가 들어있는 Local Variable의 Address로 Return Addr를 Overwrite • 환경변수에 넣으면 더 쉽게 할 수 있음

  17. Solution • Plan A • 프로그램을 잘 짜자 -_-; • ASLR • Address space layout randomization • Offset이 랜덤으로 정해지기 때문에 Exploit이 매우 힘듬 • Non-executable Stack • 스택 영역의 실행이 불가

  18. Format String Bug • Printf(“1234%n”,&i); • i에 지금까지 String의 길이, 4가 저장됨 • 이를 이용해 원하는 곳에 원하는 데이터를 덮어씌우기가 가능

  19. Vulnerable Code • Printf(argv[1]); • Str에 format string을 넣으면 format string이 실행됨 • Payload Example • \x5c\xf9\xff\xbfAAAA\x5d\xf9\xff\xbfBBBB\x5e\xf9\xff\xbfCCCC\x5f\xf9\xff\xbf%c%c%c%c%128c%n%230c%n%126c%n%4c%n

  20. Solution • Printf(str) -> printf(“%s”,str)

  21. Programmer’s Perspective • 사용자의 input을 믿지 말자 • 악의적인 input에 대한 체크 • 귀찮다고 넘어가기 없음! • 권한이 걸린 프로그램은 특별히 신경쓰기 • 미리 Safe 하다고 검증된 Library등을 쓰면 훨씬 편하다

  22. Questions? • synthdnb@gmail.com

More Related