banner image 1 banner image 2

Cache Miss Attack

June 14, 2022
2 mins
command
blog-img 1
Rajesh krishnakumar
Author

The cache is an engineer’s best friend. But if we don’t handle it properly, it can turn out to be enemy.

By Rajesh krishnakumar— “Go above and beyond!”

Why Cache is Important?

In today’s era, we all know what the advantage of caching systems are. Like how the cache is helping us speed up a process or request. But it has some downside too… Let’s discuss that today.

What is a Cache miss attack?

When the attacker purposely tries to cache miss, the attacker can overload your application and database.

An attacker overloading the cache miss
The attacker can overload the cache miss. So, there will be a stress on the DB and eventually there is a chance of the application going down.

The below diagram just shows how a cache attack can take place

When a webpage is served from a cache

When a webpage is served from an application

So what happened in the above example, Let deep dive in.

When I hit example.com it served from the cache it took 60ms with response header x-cache: HIT

When I hit the same site with example.com?cachemiss it served from the application layer which took 3 sec with response header x-cache: MISS

This means the second request went to the application level and the database read.

If I give load like below mentioned. The application will be receiving an overwhelming request and eventually, the application will go down
Example.com?cachemiss1
Example.com?cachemiss2
Example.com?cachemiss3

So what is the solution?

We can strip all the parameters from the URL or keep the allowed parameter so we avoid cache miss-hit

For example:

This URL Example.com?cachemiss1 to Example.com or if this request came Example.com?cachemiss1 still it will search for Example.com in cache because cachemiss1 is not an allowed parameter

Conclusion

Use the cache effectively and reduce the Latency. Happy Caching!


Meet the team!

Author
Rajesh krishnakumar

Editor
Mridula Saravanan


We at CaratLane are solving some of the most intriguing challenges to make our mark in the relatively uncharted omnichannel jewellery industry. If you are interested in tackling such obstacles, feel free to drop your updated resume/CV to careers@caratlane.com!
blog-img 2

Discussions

blog-img 3
5 mins
May 17, 2023
Sharing Data Between Controllers: Best Practices S...

This article will help you to understand the diffe

By Naveen C

blog-img 3
5 mins
March 21, 2023
Understanding Auto Layout and Constraints in Swift...

This article gives you an easy way of understandin

By Ramasamy P