https://www.sonarsource.com/blog/why-code-security-matters-even-in-hardened-environments

A recent study demonstrates that even in hardened environments with read-only file systems, attackers can exploit file write vulnerabilities in Node.js applications to achieve remote code execution. This is accomplished by manipulating exposed pipe file descriptors, bypassing typical security restrictions.

The research highlights the limitations of infrastructure hardening as a sole security measure. Attackers can leverage vulnerabilities in the application’s source code, even when the underlying infrastructure is fortified.

The attack involves writing crafted data structures to anonymous pipes used by Node.js’s event loop, ultimately triggering the execution of arbitrary code. This technique exploits the “everything is a file” philosophy in Unix-based systems and demonstrates the importance of code security.

Key findings include:

  • Bypassing Read-Only Restrictions: Attackers can write to pipe file descriptors, even when the file system is mounted read-only.
  • Manipulating Event Handlers: Attackers can craft data structures to manipulate Node.js’s event handler and execute arbitrary code.
  • The Importance of Code Security: Infrastructure hardening alone is insufficient; vulnerabilities in the source code must be addressed.

This research underscores the need for developers to prioritize code security, even in environments with robust infrastructure hardening. Vulnerabilities at the source code level can be exploited, regardless of other security measures.