A deep dive into how glibc's getaddrinfo() accepts IPv4 addresses in wildly unconventional formats — mixed bases (hex/octal/decimal), Unicode digit variants, invisible characters, and odd part counts — all resolving to a legitimate IP. The author demonstrates that any validation relying on superficial string matching of IP addresses can be trivially bypassed.
背景
文章指出IPv4地址本质是32位整数,点分四段只是人类可读的表示方式;底层解析器源自4.2BSD的inet_aton规则,每段独立解析且自动识别进制,因此可混用不同进制和非常规字符表示同一IP。
- 来源
- Lobsters
- 发布时间
- 2026年11月6日 22:47
- 评分
- 6.0 / 10