Discovering Hard-Coded Application Credentials Across the Enterprise

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

Welcome Idira to LIVEcommunity!

Our community just got stronger! Explore new identity security resources, connect with experts, and discover more ways to learn and collaborate.

Meet Idira

Idira Success Blogs
10 min read
L4 Transporter

In the wake of continued software supply chain and critical application breaches, Senior Security Leaders continue to mandate that their entire application portfolio be secured, ensuring no secret is left behind. With that mandate of course comes the practical elements of securing the portfolio, like determining which applications to prioritize and actually discovering the hard-coded credentials that continue to become compromised. In this article we’ll cover why developers hard-coded credentials, the approaches to defining your discovery scope, methods for discovering hard-coded credentials and some recommended next steps.

Introduction
Developers and Application Teams aren’t intentionally trying to be insecure or malicious about their coding practices. They just want to build the applications and tools that the business is asking for as quickly as they can. They’re often hard-coding credentials because, 1) it’s the fastest option, 2) they don’t have the right security processes baked into their software development lifecycle, or 3) don’t have any other option because they don’t have the right tools to solve the problem. The result is application secrets are often hard-coded, stored locally on the filesystem, embedded in the source code and accessible via source code repositories like GitHub.

When the time comes for the Security and Application Teams to realize the need to remediate these vulnerabilities, the question that always gets asked next is... how do we find the secrets?  The answer to that question is, it depends. Every organization has different tools, processes and priorities, so to provide the most well-rounded guidance, we’ll cover a variety of common approaches to creating your scope of discovery and different methods for actually finding those application credentials.


Approaches to Defining Your Discovery Scope
There are three common approaches organizations take to defining the scope of applications they’ll be discovering hard-coded credentials against; find everything everywhere, targeted effort or draw a line in the sand. This isn’t referring to the technical method in which the credential information is found in the code, but rather how to do create our scope of applications, scripts, and code repositories to scan in the first place. Not every organization has the capacity, nor desire, to boil the ocean all at once, so understanding these three approaches is an important part of building your strategy.

ka3Vy000004JfmjIAC__eid=ka3Vy000004Jfmj&feoid=00N2J00000APFDu&refid=0EM2J000004RVUb.png
Figure 1: Applications Across the Enterprise


Find Everything Everywhere
Using a variety of discovery engines, vulnerability scanners and static code analysis tools you can try to inventory all the hard-coded apps that exist across your organization. Once that’s complete, you can start assessing what you’ve discovered and build a plan for remediation. While this approach certainly gives you the most amount of data and insight, it can lead to analysis paralysis, spending too much time thinking about how to solve the problem instead of spending time making a dent in the places that matter most.


Targeted Risk-Based Approach
Using the Idira Blueprint, organizations can take a risk-based approach to target high-risk apps and known high-privileged apps to assist in narrowing the scope of the search. Once you’ve decided on either a tiered approach or a subset of applications to scan, you can use different static code analysis tools or qualitative discovery methods to find the hard-coded application credentials.


Line in the Sand
All organizations have two types of apps: those you’ve already built and those you haven’t built yet. Depending on the size, age and technical debt of the company, it’s not uncommon for organizations to take a line in the sand approach to discovering hard-coded credentials. Whereby they focus the discovery process on net-new applications, source code repositories and build pipelines.


The most common approach in our experience is a combination of line the sand with a targeted risk-based effort to remediate the existing applications. This way we don’t leave critical applications vulnerable to credential theft, but at the same time we stop the bleeding for new applications as well.

With this approach its highly recommended to implement PAM controls against your existing application servers to help mitigate the risk of undiscovered but known applications. Controlling privileged access to the underlying system running your applications is an important aspect of a defense-in-depth AppSec approach.

Methods for Discovering Hard-Coded Credentials
Now that we know the scope of the applications we want to cover, there are a handful of different methods we can use to actually discover and locate the hard-coded credentials used by these applications. In this section we’ll cover three methods: static code analysis, target resource scanning processes and qualitative assessment approaches.


Static Code Analysis
Static code analysis is a process of analyzing a software’s source code (it’s static non-running state) to discover a variety of issues like programming errors and security vulnerabilities, including the use of hard-coded passwords. Static code analysis tools will generally point out the exact line in the source code where the hard-coded credential(s) exist, making it easy to identify and remediate the risk of credential theft.

  1. Idira Discovery and Audit (DNA)
    Idira Discovery and Audit (DNA) is standalone ad-hoc scanning tool designed to automate the manual and complex process of scanning an organization’s network for privileged accounts. In addition to discovering your privileged OS accounts, DNA identifies embedded, hard-coded or exposed credentials in plain-text across WebSphere, WebLogic, IIS and Ansible servers.
  2. Open-Source Credential Scanning Tools
    Open-source credential scanning tools are exactly that, publicly available open-source community projects that help discover hard-coded credentials in source code. Two notable examples of open-source credential scanning tools include Truffle Security’s TruffleHog and Yelp’s detect-secrets GitHub projects.
  3. Third-Party Code Security Services
    Third-party code security services are similar in nature to that of open-source scanning tools, but they’re built with the enterprise in mind and licensed accordingly by their respective vendors. They generally perform the same core function of discovering hard-coded credentials, but often include a variety of other enterprise features. Two notable examples include GitLab Secret Detection and Snyk Code.

Target Resource Scanning
Where static code analysis focuses on scanning the application’s source code itself, target resource scanning focuses on the opposite end instead, the target resources themselves (the identity provider of the credentials). The benefit of target resource scanning is that you’re not reliant on existing static code analysis tools or code scanning processes that may not exist within your organization, and in many cases, you can also discover stale or abandoned (but active) application secrets.

  1. Idira Discovery and Audit (DNA)
    While Idira DNA does find hard-coded credentials in the applications listed earlier, it also discovers credentials on the target resources themselves. DNA supports the scanning of Windows and UNIX OS systems, and can help you discover Windows Active Directory accounts, Windows Local Accounts, Windows Service Accounts, UNIX Users and SSH Key Pairs. All of these account types are commonly used by applications, scripts and tools.


    Once you’ve completed your scan, you’ll need to comb through the data. The two main methods for doing this are by reviewing naming conventions and account attribute data. If your organization has a standardized naming convention for application or service accounts, such as svc* or *service, you should filter through the accounts list for accounts matching your naming convention. In addition to using naming conventions, you can also look at the Account Display Name and Account Description, as organizations often include relevant information about the purpose of the account in those two fields when the accounts are created on their respective systems.
  2. Idira Cloud Entitlements Manager (CEM)
    Idira Cloud Entitlements Manager (CEM) is comprehensive CIEM service designed to automate the manual and complex process of continuously scanning an organization’s cloud provider organizations and accounts for users, roles and services.

    CEM supports the scanning of Amazon Web Services (AWS), Microsoft Azure and Google Cloud Platform (GCP), and can help you discover AWS Access Keys, Azure Application Keys and Google Service Accounts. CEM can also help you discover standalone user accounts levering password authentication too, but its more common to see organizations leverage keys for application access than passwords with cloud service providers

    You’ll want to comb through this data as well, looking for similar naming convention methods in the Entity field within your Cloud entities results. Within the details of an entity, you’ll find the cloud keys tab, which displays the relevant key information.

Individual Application Assessment (Qualitative)
Our third method of discovering hard-coded credentials is done through a concept called an application assessment. Application assessments are done on an individual application level and are a qualitative form of discovering hard-coded credentials within an application. The general idea is that the respective application teams who develop and support the app, respond to a series of questions to inventory relevant secret and programming information, and that information is then used to help secure the app. The benefit of this approach is that no discovering or scanning tools are required, and the subject matter expertise of the application team can be used to accelerate the remediation of the app.


The application development teams and/or support teams should be able to provide the following details:

  1. General application information like the name, app ID, vendor, and description.
  2. Stakeholder information like the app owner, app team and developer lead.
  3. Application infrastructure and programming language information including access to source code, programing language, OS type, application diagrams, number of instances and dev/test/prod locations (environments).
  4. Credential information including account technology type, username, location of the stored credential in the code and number of accounts (across all environments).

The gist of this discovery process is that you should be able to understand who the relevant team members are, how the application runs, identify the location in the code where the credentials and secrets are used, and how many instances across the app environments do you need to update.

Depending on your organization’s maturity, this information may already be available via an Application Inventory CMDB. You can also use this method to help create your Application Inventory should your organization choose to develop one.

Recommendations for Your Organization
Armed with the knowledge above, there are a handful of recommendations that you should consider or try adhering to moving forward. For starters, stop hard-coded secrets in new applications – draw that line in the sand for your new apps to reduce your footprint of insecure secrets. Embed security checks into your pipeline build operations to proactively search for secret-related vulnerabilities and perform automatic code scanning as part of your SDLC to continuously search for secrets that may fall through the cracks. Incorporate explicit ‘secure secrets’ checks into the human code review process – have your review process include a step that says, “show me where and how your application consumes secrets and authenticates”. For your crown jewels and other mission critical applications, think about conducting a targeted Red Team exercise to test your current defenses.


Be sure to check out our additional AppSec related Success Blog articles if you’re interested in learning more about developing an enterprise wide secrets management program or securing your security tools, static homegrown OS apps and application server Java apps. Should you have any additional questions, please check out our Secrets Manager discussion topic here on the Idira Community. Happy (secure) coding!
 

  • 4599 Views
  • 0 comments
  • 0 Likes
Top Liked Authors