hero bg no divider
가이드라인

인젝션 101

가장 잘 알려진 취약점 종류 중 하나가 인젝션 취약점인 경향이 있는데, 그 중에서도 놀랍게도 그 후손인 SQL Injection (SQL Injection) 이 있습니다.기술 세계에서는 SQL 인젝션에 대한 이야기를 듣지 않기가 어렵기 때문에 이에 대해 이야기해 보도록 하겠습니다.

SQL 인젝션을 사용하면 SQL 쿼리의 동작을 조작하여 공격자의 입찰을 수행할 수 있습니다.

표면은 다르지만 모두 동일한 원리로 작동하는 다른 유형의 주사도 많이 있습니다.

요약하자면, 가장 일반적인 주사 유형은 다음과 같습니다.

  • SQL 인젝션
  • 크로스 사이트 스크립팅 (HTML/자바스크립트 인젝션)
  • 경로 탐색 (경로/URL 삽입)
  • 명령어 인젝션
  • 코드 인젝션

어 리틀 인젝션 101

이전 삽입 유형 목록을 보면 모두 한 가지 공통점이 있습니다. 모두 문자열과 관련되어 있으며 인터프리터를 통해 실행되고 문자열이 나타내는 모든 작업을 수행합니다.“사용자 입력”을 중괄호로 표시했습니다.

Type Example input How it’s interpreted
SQL SELECT name FROM users WHERE username = '{admin}' Selects the "Name" column from all rows from the users table where the username is 'admin'
HTML {John Smith} Shows the name "John Smith" in bold letters
Path /var/www/app/documents/{privacy-policy.pdf} Points at the file `privacy-policy.pdf` in the `/var/www/app/documents/` folder
Command ping {8.8.8.8} Sends a series of ICMP pings to the IP `8.8.8.8`
Code const name = '{John Smith}'; Sets the constant variable `name` to the value `John Smith

그렇다면 사용자 입력 삽입이 안전하지 않으면 어떻게 될까요?공격자는 무엇을 할 수 있을까요?다시 말씀드리지만, 이 시나리오에서는 중괄호 안의 모든 항목이 “사용자 입력”으로 간주됩니다.

Type Example input How it’s interpreted
SQL - Injected SELECT name FROM users WHERE username = '{1' UNION SELECT passwordhash from users WHERE username = 'admin}' Selects the "Name" from all rows from the users table where the username is 'admin', and the password hash for the users where the username is 'admin'
HTML - Injected {} Show the name "John Smith" in bold letters
Path - Injected /var/www/app/documents/{../../../../../etc/shadow} Points at the file `shadow` in the `/etc/` folder
Command - Injected ping {8.8.8.8 && ls . } Sends a series of ICMP pings to the IP `8.8.8.8`, and prints the contents of the current directory with `ls`
Code - Injected const name = '{John Smith'; exec('ls .'); # }'; Sets the constant variable `name` to the value `John Smith`, and then executes the system command `ls .

이 예제에서는 입력이 사용자 입력의 결과에 영향을 미치는 데 어떻게 사용될 수 있는지 살펴보겠습니다.

이것이 주사의 본질입니다.인터프리터가 원래 프로그래머가 의도한 것과 다른 일을 하도록 하기 위해 인터프리터에게 전달되는 내용에 영향을 미치는 거죠.

이것들은 고려해야 할 기본 사항일 뿐입니다.좀 더 주의를 기울일 필요가 있기 때문에 다양한 삽입 유형 중 일부를 개별 페이지로 구분했습니다.

여기에서 찾을 수 있습니다.

명령 인젝션

경로 탐색

SQL 인젝션

크로스 사이트 스크립팅