강의

멘토링

커뮤니티

Inflearn Community Q&A

veritas43176131's profile image
veritas43176131

asked

SQL Injection Attack Techniques and Secure Coding Explained by a Simulated Hacking Practitioner: PART 1

[Practice 2-3] Correct vulnerability check method for column parameters of search function

mysql case when 구문이용

Resolved

Written on

·

382

1

검색 기능 부분 select * from board where title like '%검색어%' 이 구문에서

Select * From board Where title like '%'||(case when 1=1 then 'test' else 'aaaaaa' end)||'%'

이 문장과 같이 검색어에 case when 구문을 이용해서 조건 구문을 완성 시킬 수 있다고 하셨는데

||연산자를 쓰는 oracle에서는 가능하지만 mysql, mssql에서는 불가능한데 어떤 방식으로 case when구문을 완성 시킬 수 있는지 잘 모르겠습니다.

concat을 이용해야 하나요? 예시를 좀 알려주실 수 있을까요?

 

모의해킹인젝션

Answer 1

1

crehacktive님의 프로필 이미지
crehacktive
Instructor

mssql의 경우는 연결 연산자가 +이기 때문에 +로 가능합니다.

like '%'+(case when 1=1 then 'test' else 'aaaaaa' end)+'%'

 

mysql의 경우는 이런 구문 만들지 못합니다.

concat의 경우는 title like '%' and concat(~~~~ 이런 형태만 가능하며,

like '%문장%' 이안에서는 활용하지 못합니다.

cassis님의 프로필 이미지
cassis
Questioner

감사합니다 이해했습니다:)

veritas43176131's profile image
veritas43176131

asked

Ask a question