APIs Used by Bots to Detect Public IP address
Many of the bots I am observing attempt to detect the infected system's public ("WAN") IP address. Most of these systems are assumed to be behind NAT. To detect the external IP address, these bots use various public APIs. It may be helpful to detect these requests. Many use unique host names. This will make detecting the request in DNS logs easy even if TLS is not intercepted.
Note that there is useful software using these APIs. Do not just block them. But keeping an eye on who is sending these requests can be useful
Here are a few I remember seeing. The list I have seen isn't very long, making it easy to detect. Let me know if there are others:
- http://ip-api.com/json/
- http://api64.ipify.org
- http://api.ipify.org
- https://ip.seeip.org
- http://checkip.dyndns.org
- https://ipapi.co/ip/
Some of these APIs will block commonly abused user agents like 'curl' or 'pylib.' This will block many of the common bots from using the specific APIs (and they typically do not bother to specify a user agent but instead use a different API without restrictions).
There are some other websites that malware could use with a bit of screen scraping, but I have not seen malware use them. And as you are looking through your logs: Requests for "wanipcn.xml" are not related to looking up the WAN IP address. These requests attempt to exploit an older Realtek SDK vulnerability.
---
Johannes B. Ullrich, Ph.D. , Dean of Research, SANS.edu
Twitter|
Application Security: Securing Web Apps, APIs, and Microservices | Online | US Eastern | Jan 27th - Feb 1st 2025 |
Comments
jc
Feb 6th 2023
1 year ago
ip-info.ff.avast.com
Interestingly, CAPE Sandbox has a signature for this: https://www.capesandbox.com/analysis/360850/
ibell63
Feb 6th 2023
1 year ago
DomDeVitto
Feb 6th 2023
1 year ago
DomDeVitto
Feb 6th 2023
1 year ago
DomMcIntyreDeVitto
Feb 6th 2023
1 year ago
ID
Feb 7th 2023
1 year ago
https://checkip.amazonaws.com
JSON
https://ipinfo.io
Both work with http:// prefix. On 5G connection the output may differ though, depending on how clever your 5G ISP / MTiM is.
ipinfo.io is even shorter than ifconfig.io, but it would normally require a free or paid subscription. For low volumes of requests it will work without API token
Wang Wei
Feb 8th 2023
1 year ago