4 ms·
With this, can you send JSON with arbitrarily large integers to an API and make them churn on a gigabyte of digits? Has potential as a denial of service attack.
by Animats 10y ago
With this, can you send JSON with arbitrarily large integers to an API and make them churn on a gigabyte of digits? Has potential as a denial of service attack.
- defen 10y agoIt's important to remember that JSON is "very close" to Javascript but is not actually Javascript. JSON allows arbitrary precision numbers. So, the number `1.0000000000000001` (or, similarly, an extremely large integer) isn't representable in standard Javascript, but if a JSON encoder emits that, a "proper" parser would actually parse that as an exact value (compare Python `simplejson.parse` with `use_decimal=True` vs `use_decimal=False`). I guess what I'm saying is that a proper JSON parser kinda already has this issue.
- Klathmon 10y agoYou could already send gigabytes of JSON garbage right now and DDoS them... Also i don't think this has anything to do with JSON.
- firloop 10y ago>"Integers in JSON data will probably be handled similarly to other unsupported data such as symbols:" >JSON.stringify(123n) undefined I guess their proposal accounted for this by not supporting integers at all. But this could still be possible if you knew a service was coercing a string or similar into an Integer type (using proposed Integer.parseInt).
- nemothekid 10y agoHow is this attack vector any different from sending an arbitrarily large string?
- coldtea 10y agoIn that they can restrict loading after a specific amount to KB or MBs -- but even a "small" 100-digit integer could have disastrous runtime behavior when passed to an API.