Home Hacking News Mozilla Hardens Their Firefox Browser To Fend Off Code Injection Attacks

Mozilla Hardens Their Firefox Browser To Fend Off Code Injection Attacks

by Abeerah Hashim
Mozilla Released Firefox 130 With Handy AI Chatbot Feature And Security Fixes

Mozilla has announced another bold step towards ensuring better security for users. This time, they will be fending off code injection attacks by making changes to the Firefox browser.

Changes In Firefox Browser Against Code Injection Attacks

In a recent post, Mozilla has revealed some major changes to the Firefox browser. These changes will help Mozilla make Firefox secure against code injection attacks.

Specifically, the changes include removal of ‘potentially dangerous artifacts’ such as ‘inline scripts’ and ‘eval()-like functions’. By doing so, they strive to ‘reduce the attack surface’ and harden the code.

Removing Inline Scripts

Explaining about the removal of inline scripts, they revealed that this step would strengthen the Firefox ‘about protocol’. In simple words, there were numerous about:pages allowing an insight to the internal browser state. Notably, the about:config exposed an API allowing users to make changes to the Firefox settings. Since these pages implemented HTML and JavaScript, they remained vulnerable to code injection attacks. Consequently, Mozilla decided to remove inline scripts.

As stated in the blog post,

To better protect our users and to add an additional layer of security to Firefox, we rewrote all inline event handlers and moved all inline JavaScript code to packaged files for all 45 about: pages. This allowed us to apply a strong Content Security Policy (CSP) such as ‘default-src chrome:’ which ensures that injected JavaScript code does not execute. Instead JavaScript code only executes when loaded from a packaged resource using the internal chrome: protocol.

Removing eval()-like Functions

In another attempt to reduce the attack surface, Mozilla decides to remove a ‘powerful yet dangerous tool’ – eval()-like Functions.

According to the blog,

To further minimize the attack surface in Firefox and discourage the use of eval() we rewrote all use of ‘eval()’-like functions from system privileged contexts and from the parent process in the Firefox codebase. Additionally we added assertions, disallowing the use of ‘eval()’ and its relatives in system-privileged script contexts.

Besides, during their assessment, they noticed some uses of eval to customize Firefox start up via unintended tricks. So, for such cases, they assure allowing usage of eval().

Let us know your thoughts in the comments.

You may also like