News for hackers. Stuff that matters.
Re:IP addresses and routing by buro9 on Thursday July 26, 2018 @09:13AM (#17617141)
Recently I discovered how weird IP addresses are on local machines:

Ping the following:

1.1.257

3.141592

0x01000001

198.2742178

All the fault of https://linux.die.net/man/3/inet_aton as everyone follows the implementation and there is no RFC on how to shorthand/collapse an IP address.

Re:IP addresses and routing by peterwwillis on Thursday July 26, 2018 @12:15PM (#17618593)
Yep. We used to use this to work around dumb HTTP content filters/firewalls with IP blacklists. Just convert the IP to decimal and try your request again. (Doesn't work so well now that the internet is huge and every IP hosts multiple virtual hosts)
Re:IP addresses and routing by pingofdoom on Thursday July 26, 2018 @10:04AM (#17617592)
lol so those ping to two different addresses:

  ping 192.168.1.64
  ping 192.168.1.064
Good material for underhanded c contest...
Re:IP addresses and routing by akeruu on Thursday July 26, 2018 @10:57AM (#17617961)
This happens more often then you might think.

A lot of people are adding padding when they need to store IPs. So they can be easily sorted using alphanumeric sort:

192.168.001.001 192.168.001.002 192.168.001.003 ... 192.168.001.254

And then use it that way to connect to servers, causing lots of confusions.

Re:IP addresses and routing by rashkov on Thursday July 26, 2018 @11:12AM (#17618076)
wait, really? padding with zeros maps to a different IP address than the non-padded version? Is that because a leading zero causes it to be interpreted as an octal number?
Re:IP addresses and routing by iooi on Thursday July 26, 2018 @11:46AM (#17618366)
Yes.

    In [2]: socket.inet_aton('226.000.000.037')
    Out[2]: b'\xe2\x00\x00\x1f'

    In [3]: socket.inet_aton('226.000.000.37')
    Out[3]: b'\xe2\x00\x00%'

    In [4]: socket.inet_ntoa(b'\xe2\x00\x00\x1f')
    Out[4]: '226.0.0.31'

    In [5]: socket.inet_ntoa(b'\xe2\x00\x00%')
    Out[5]: '226.0.0.37'
Re:IP addresses and routing by kiallmacinnes on Thursday July 26, 2018 @12:28PM (#17618701)
Oh, wow.

I.. wow.

No words come to me!

Learn something new everyday!