The Need for Secure Coding Practices: Lessons from the Optus Breach

Thomas Hampson
3 min readJun 23, 2024

--

Key left in door lock with door slightly open.
Is insecure code leaving the keys to your application in plain sight?

The recent Optus Mobile data breach, compromising the personal information of over nine million of their users, is a stark reminder of the importance of secure coding practices.

A “coding error” led to this massive security failure, underscoring how minor mistakes can have devastating consequences. This incident serves as a wake-up call for developers to prioritise security in their coding practices.

High-Profile Security Breaches Due to Poor Coding Practices

The Optus breach isn’t an isolated incident. Several other notable breaches highlight the repercussions of insecure coding.

Every year, a significant number of breaches occur due to hardcoded credentials left in source code. In 2019, nearly half of all breaches were linked to misuse of credentials found in public repositories like GitHub. Developers often leave sensitive information in code, which becomes publicly accessible and vulnerable to exploitation.

One notable example is the breach involving hardcoded credentials in several GitHub repositories, which exposed the data of over 200,000 patients. This breach, uncovered in 2020 by security researcher Jelle Ursem, involved credentials embedded directly in source code, giving unauthorised access to sensitive healthcare data, including Microsoft Office365 environments and databases containing millions of records​.

Another significant incident was the Uber breach in 2016, where hardcoded credentials left in a code repository on GitHub allowed attackers to access the personal information of 57 million drivers and users​.

Best Practices for Secure Coding

To mitigate the risks of such breaches, developers should adhere to industry best practices for secure coding:

1. Regularly conduct code reviews and use static analysis tools to identify and fix vulnerabilities early in the development process. This helps catch errors that might otherwise go unnoticed until they become critical issues.

2. Ensure all user inputs are properly validated and sanitized to prevent common attacks like SQL injection and cross-site scripting (XSS).

3. Implement strong encryption for sensitive data both in transit and at rest. This includes using HTTPS for data transmission and encrypting sensitive information stored in databases.

4. Apply the principle of least privilege by granting users and applications only the permissions they need to perform their functions. This minimizes the potential damage from a compromised account.

5. Conduct regular security testing, including penetration testing and vulnerability assessments, to identify and address potential weaknesses in your applications.

6. Avoid hardcoding credentials in your source code. Use secure storage solutions for managing secrets, such as environment variables, secrets management services, or encrypted files.

7. Keep all software components and dependencies up-to-date with the latest security patches. Vulnerabilities in third-party libraries can be a significant risk if not promptly addressed.

By integrating these best practices into the software development lifecycle, developers can significantly reduce the risk of security breaches and protect sensitive data. The lessons from the Optus breach and other high-profile incidents underscore the critical importance of writing secure code and following industry standards to safeguard against potential threats.

Hardening Your Application’s Security

At Meta8 (meta8.co.uk) we specialise in building secure, robust web applications, including in highly regulated industries such as payments and finance. We regularly work with businesses to modernise and secure their existing web applications, reducing the risk of serious data breaches and exploitations that could be costly, not just financially, but also to the reputation of the business.

If you’re unsure of your development team’s security posture, or your application’s vulnerability to attack, we can help to identity and resolve critical issues.

--

--

Thomas Hampson
Thomas Hampson

Written by Thomas Hampson

0 Followers

Co-Founder @ Meta8 - UK-based Software Development Company

No responses yet