Study

Unicode case mapping collision

cloudnaaam 2025. 6. 26. 12:07

- 이 글은 아직 현업을 경험하지 못한 보안 공부생의 정리 글이니, 정확하지 않을 수도 있습니다.-

 

어제 드림핵에서 워게임 문제 풀다가 관련 개념이 나와서 정리해보려고 한다.

생각치도 못했는데, 알고 나니까 신기하더라..

 

Unicode case mapping collision이란?

유니코드가 lowercasing, uppercasing 할 때 서로 충돌하여 동일하게 처리되는 현상..이라고 하는데,

쉽게 이해하기 위해 예시를 들어보면

print('ß'.lower() == 'SS') // False
print('ß'.upper() == 'SS') // True
print(ord('S')) // 83

 python으로 독일어 'ß' 를 대문자화하면 'SS' 와 같다고 인식하는 것을 볼 수 있다. 그리고 저기 있는 'S'는 10진수로 83, 즉 영문자 'S'이다.

console.log('ß'.toLowerCase() == 'SS'); // false
console.log('ß'.toUpperCase() == 'SS'); // true

Javascript 또한 마찬가지이다. 듣기로는 다른 언어들도 매핑 충돌이 일어난다고 한다.

 

admin_id = 'admin' 
my_permission = False

if not my_permission and user_input == 'admin':
	print('no permission')

if user_input.upper() == 'ADMIN':
	print('login')

 

대략 이런 식으로 서버 코드가 짜여져 있다면?

user_input 에 'ADMıN' 을 넣는다면 login이 출력되는 것을 확인 할 수 있다.

 

 

깃허브에서도 이와 비슷한 사례가 있었다고 한다. 

https://dev.to/jagracey/hacking-github-s-auth-with-unicode-s-turkish-dotless-i-460n

 

Hacking GitHub's Auth with Unicode's Turkish Dotless 'I'

From combining emoji marks and astral planes, Unicode is under appreciated and poorly understood. The...

dev.to

 

cheatsheet 도 있으니 참고하면 좋을 것 같다.

https://gosecure.github.io/unicode-pentester-cheatsheet/

 

Characters that byͥte

 

gosecure.github.io

 

'Study' 카테고리의 다른 글

JWT (Json web token)  (0) 2025.08.20
Web cache deception  (0) 2025.07.19
pugjs 취약점  (0) 2025.06.26
Prototype Pollution  (0) 2025.06.25
CSP  (1) 2025.06.24