About this question
I was wondering if there is any securitiy risk involved with raising the client_max_body_size in nginx from 1MB to 20GB?
I was wondering if there is any securitiy risk involved with raising the client_max_body_size in nginx from 1MB to 20GB?
Log in to share your answer and help other learners.
Log in to answerBest Answer · By JanBask Cyber Security Expert
Answered on Mar 24, 2022
Setting client_max_body_size to 20 GB is, obviously, not reasonable and I wonder why you would allow (users?, yourself?) to upload such very huge files. client_max_body_size governs the corresponding HTTP Header parameter. As a security good practice, we must always limit the header and message body to a minimal reasonable length. Why ? 20 GB is so huge that you put your server in the same scenario as by 2013 when Django allowed users to use a very long password forcing Django (rather the server where it is hosted) to perform very expensive hash calculations leading, as you may guess, to a denial-of-service attack against the whole Django's authentication framework.
This being said, there are other things you need to think about if you increase the size of client_max_body_size too much. For instance, how will you set keepalive_timeout parameter ? How could you calculate it based on the fact that client_max_body_size is set to 20 GB ? Maybe 20 seconds ? 20 minutes ? Two hours ? Same question concerns client_header_timeout and client_body_timeout that set, respectively, set the maximum amount of time Nginx will wait around on the client to specify a request header or ask for an object to be served.
Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.
Step-by-step Cyber Security guides from industry experts
Common Cyber Security interview questions, answered
Guides, tips and career advice on Cyber Security from JanBask experts.
Cyber Security Prepare with 100 Cyber Security Interview Questions & Answers
Boost your interview confidence learn answers to 101 common cybersecurity questions, from basics to advanced techniques.
Cyber Security AI in Cybersecurity: The Double-Edged Sword
Explore how AI is reshaping cybersecurity as a double-edged sword. Learn how attackers use AI for sophisticated threats and how…
Cyber Security Exploring the Advantages and Disadvantages of Ethical Hacking
Discover the key advantages and disadvantages of ethical hacking from enhancing security and regulatory compliance to potential…
Cyber Security Top Cyber Security Projects Ideas to Consider in 2025
Explore 19 practical cybersecurity project ideas for 2025, from AI threat detection to honeypots. Build skills, boost your…