7 Open-Source Tools for Securing Your Code
Tags: security, codequality, opensource
Published: 2019-11-15 08:20:15

In the last few years, some of the largest data breaches have been due to vulnerabilities in source code. From the [Equifax breach](https://www.cnet.com/news/equifaxs-hack-one-year-later-a-look-back-at-how-it-happened-and-whats-changed/) to the notorious [Facebook’s breach](https://www.techrepublic.com/article/facebook-data-privacy-scandal-a-cheat-sheet/) that exposed the private data of almost 87 million users. These breaches may have been prevented or at least minimized had the code in their applications been secured from the start.

In this article, you’ll learn what secure coding is. You’ll also be introduced to some tools that can help you secure your own code as well as that of your applications.

## What Is Secure Coding?

Secure coding is the process of developing code in a way that ensures security and eliminates vulnerabilities. It requires language-specific knowledge of exploitable issues. It also requires an understanding of vulnerabilities associated with host environments and integrations. 

Secure code is the first line of defense against attacks. While you might not be able to control all of the variables that can lead to vulnerabilities in your environments or integrations, you do have control over your source code. The fewer vulnerabilities you include, the more secure you and your users are.

As teams adopt DevSecOps methodologies, the use of secure coding practices is becoming a requirement for many developers. Eliminating vulnerabilities in code during development is cheaper and often easier than patching issues in production. 

## 7 Open-Source Tools for Secure Coding

There are a wide variety of open-source tools available to help you develop and ensure [secure coding practices](https://resources.whitesourcesoftware.com/blog-whitesource/secure-coding). The tools below can be used in a variety of environments and languages. However, there are language-specific tools you can use that might be able to give you more specific recommendations for your applications.


1. [Juice Shop](https://juice-shop.herokuapp.com/#/)
Juice Shop is a training tool created by the Open Web Application Security Project (OWASP). It is an intentionally vulnerable web application that includes examples of common vulnerabilities.

2. [Code Warrior](https://github.com/CoolerVoid/codewarrior)
Code Warrior is a tool you can use to perform manual code review and static analysis. You can use it with Linux, BSD, and MacOS. Code Warrior works through your web browser on your localhost using HTTP with TLS.
Code Warrior supports multiple languages, including C, C#, Java, PHP, Ruby, and JavaScript. It includes built-in rules to cover known secure coding standards. You can also create custom rules.

3. [Arachni](https://www.arachni-scanner.com/)
Arachni is a fully automated Dynamic Application Security Testing (DAST) tool that you can use to scan websites and applications. It works using asynchronous HTTP requests and you can use it on all major operating systems. 
Arachni is commercially supported but free for most use cases. Arachni includes features for detecting cross-site scripting, code injections, file inclusions, and data scraping. It also includes an integrated browser environment and a REST API. You can extend its functionality through a variety of plug-ins and modules.

4. [Wapiti](http://wapiti.sourceforge.net/)
Wapiti is a DAST tool you can use to scan your web applications. You use it through a command-line interface. It works by attempting to inject payloads into forms and scripts. It supports GET and POST methods of attack. 
Wapiti includes features for fuzzing, performing brute force attacks, detecting file disclosures, and using a variety of authentication methods. Fuzzing is when you provide various types of invalid, unexpected, or random inputs to check how an application responds.

5. [Dependency Track](https://dependencytrack.org/)
Dependency Track is a tool that enables you to keep track of third-party components in your applications. It works for applications you’ve developed as well as those you’re using. You can use it on-premise or as a web application. It is integrated with vulnerability databases, such as the National Vulnerability Database (NVD), Sonatype OSS Index, and VulnDB. Dependency Track includes features for centralized tracking, integration with Active Directory and LDAP, and notifications via webhooks. It can also provide impact analyses of vulnerabilities and out of data components.


6. [Metasploit Framework](https://www.metasploit.com/)
Metasploit is a penetration testing framework that enables you to automate attack testing. Using Metasploit, you can attempt specific exploitation of issues with built-in or custom payloads. You use it via a command-line interface. It works on both Windows and Linux.  
Metasploit includes modules that function as encoders, shellcode, post-exploitation code, and listeners. It comes already integrated with Kali, a popular pentesting Linux distribution.

7. [SonarQube](https://www.sonarqube.org/)
SonarQube is a tool you can use to expose vulnerabilities in code and measure your source code quality. It ranks vulnerabilities according to severity. You use it via an interactive GUI that is beginner-friendly. It is written in Java but can be used with over 20 common languages. 
SonarQube includes features for analyzing pull requests, code branch tracking, and project timeline visualization. You can integrate it with continuous integration tools like Jenkins.

## Conclusion

In the past, developers were not necessarily responsible for ensuring that their code was secure from the start. Security was the responsibility of security teams. This is often no longer the case and security is now a shared responsibility. 

If you’re not used to standards of secure coding, it can seem overwhelming at first. Luckily, there is an abundance of tools and resources available to help you learn and practice secure coding standards. With a little patience and dedication, secure coding should become second nature. Hopefully, the tools covered here can help get you started.