Secure Engineering Guidelines

Some best practices for building and trusting software.

Do Not Trust Input

  • SQL Injection, where untrusted user input is used in raw SQL queries (use parameterized queries).
  • Cross-Site Scripting, where untrusted user input is used in raw HTML, CSS, or JavaScript sent back to the user’s web browser (use a
    template engine or sanitize input).
  • JSON Injection, where untrusted user input is used in raw JSON (use a JSON library to build JSON blobs).
  • Shell Injection, where untrusted user input is used in shell commands.
  • Code Injection via deserialization, where untrusted user input is used in serialized objects.

Minimize Attack Surface

Architect and Design for Security

Favor Simplicity

Principle of Least Privilege

Separation of Duties

Defense in Depth

“In a composite system, there is no critical gate: everything is a gate.” — Felix ‘FX’ Lindner

Secure Defaults

Secrets Management

Fail Securely

Fix Warnings and Errors

General Do Nots

  • Do not trust vendors and third-party services.
  • Do not output user input into a client-side JavaScript context.
  • Do not use user input in shell commands.
  • Do not use user input in Windows paths.

Third-Party Libraries

  • Do you trust the library, the author, and their infrastructure? An adtech company might approach the author and ask them to insert a snippet that collects information about your code or your users. A developer could use their library for criminal activity, such as credit card theft or ransomware.
  • How easy would it be to own the author or their infrastructure? A popular library could be a target for attackers.
  • Does it do anything that you consider dangerous? Examples include remote access or arbitrary code execution.
  • Does the plugin send information to a remote server? Is the data it sends sensitive?

--

--

Risk philosopher. CISO. Team and program builder. Ex-vulnerability researcher. Ex-CTF organizer and competitor.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Julian Cohen

Risk philosopher. CISO. Team and program builder. Ex-vulnerability researcher. Ex-CTF organizer and competitor.