March 19, 2019

WebGoat write-up(SQL Injection 7)

To comply with the rule, in this write up, some hints related to this challenge only will be mentioned.

룰을 준수하기 위해, 여기서는 챌린지와과 관련된 몇 가지 힌트만이 언급됩니다.

previous example. The query in the code builds a dynamic query by concatenating strings making it susceptible to String SQL injection:

아래의 쿼리는 이전 예제에서와 비슷한 느낌의 동적 쿼리다. 이 쿼리는 단순히 문자열들을 연결하여 동적 쿼리를 구성하는데 스트링 SQL 인젝션에 취약하다.

"select * from users where LAST_NAME = '" + userName + "'";

Using the form below try to retrieve all the users from the users table. You shouldn’t need to know any specific user name to get the complete list, however you can use 'Smith' to see the data for one user.

아래의 입력 폼을 활용하여 "users"테이블에서 모든 사용자를 검색하라. 전체 사용자 리스트를 얻기 위해서 특정 사용자의 이름을 알 필요는 없다. 그러나 "Smith"를 사용하면 한 사용자의 데이터를 검색할 수 있다.

WebGoat write-up(SQL Injection 7) result

As mentioned above, finally, the condition "1=1" is always true, and the contents after that will be annotated of DBMS, so all records in the table are popped out.

위와 같이, 최종적으로 "1=1" 조건은 항상 참이고, 그 이후의 내용은 DBMS에서 주석 처리되기 때문에, 해당 테이블의 모든 레코드들이 튀어나오게 된다.