Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- Computer Architecture
- system hacking
- fastapi를 사용한 파이썬 웹 개발
- MDP
- FastAPI
- BFS
- Dreamhack
- Algorithm
- Widget
- Stream
- Image Processing
- BAEKJOON
- pytorch
- rao
- ARM
- bloc
- C++
- ML
- Kaggle
- BOF
- 파이토치 트랜스포머를 활용한 자연어 처리와 컴퓨터비전 심층학습
- MATLAB
- llm을 활용 단어장 앱 개발일지
- Flutter
- 영상처리
- study book
- 백준
- DART
- Got
- PCA
Archives
- Today
- Total
Bull
[PHP] 비교 연산자 취약점 (7.4.x) 본문
웹 컴파일러
PHP Sandbox - Execute PHP code online through your browser
onlinephp.io
해당 사이트에서 버전을 7.4.x로 바꿀 수 있다.
Type 비교 연산자 취약점
다음과 같이 문자열을 (int)
를 사용해 강제 형변환을 해준다.
그러면 위와 같이 숫자가 끝날때 까지는 숫자를 반환하고 문자는 0을 반환한다.
따라서
if((int)"aaaa" == "rrr") # if(1)
의 반환값은 true가 된다.
이 취약점의 공식? 명칭은 Type juggling & casting이다.
7.4.x → 8.0.x 변경사항
https://www.php.net/manual/en/migration80.incompatible.php
PHP: Backward Incompatible Changes - Manual
In PHP 8, an empty string is less than any number, an English letter is always bigger than any number.More interesting are the punctuation marks and non-word characters, some bigger than numbers, some smaller than numbers$string = '`~!@#$%^&*()-_=+[]{};:\'
www.php.net
해당 취약점은 버전이 변경되면서 false가 나오도록 변경되었다.