<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Thomas Segura on Medium]]></title>
        <description><![CDATA[Stories by Thomas Segura on Medium]]></description>
        <link>https://medium.com/@thomas.segura?source=rss-58fcd5704426------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*k4K3UM-RzunZY76G</url>
            <title>Stories by Thomas Segura on Medium</title>
            <link>https://medium.com/@thomas.segura?source=rss-58fcd5704426------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 23:02:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@thomas.segura/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Understanding the Risks of Long-Lived Kubernetes Service Account Tokens]]></title>
            <link>https://medium.com/gitguardian/understanding-the-risks-of-long-lived-kubernetes-service-account-tokens-07f10e866ef2?source=rss-58fcd5704426------2</link>
            <guid isPermaLink="false">https://medium.com/p/07f10e866ef2</guid>
            <category><![CDATA[identity-management]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[security-token]]></category>
            <category><![CDATA[cloud]]></category>
            <dc:creator><![CDATA[Thomas Segura]]></dc:creator>
            <pubDate>Thu, 11 Jan 2024 11:09:05 GMT</pubDate>
            <atom:updated>2024-01-29T09:18:29.253Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PR6oqxZmaPy14kxM.png" /></figure><p>The popularity of Kubernetes (K8s) as the defacto orchestration platform for the cloud is not showing any sign of pause. This graph, taken from the <a href="https://www.wiz.io/blog/key-takeaways-from-the-wiz-2023-kubernetes-security-report?ref=blog.gitguardian.com">2023 Kubernetes Security Report</a> by the security company Wiz, clearly illustrates the trend:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4kxKzq6zGsBGds076quHXg.png" /></figure><p>As adoption continues to soar, so do the security risks and, most importantly, the attacks threatening K8s clusters. One such threat comes in the form of long-lived service account tokens. In this blog, we are going to dive deep into what these tokens are, their uses, the risks they pose, and how they can be exploited. We will also advocate for the use of short-lived tokens for a better security posture.</p><h3>What Are Kubernetes Service Account Tokens?</h3><p>Service account tokens are <strong>bearer tokens</strong> (a type of token mostly used for authentication in web applications and APIs) used by service accounts to authenticate to the Kubernetes API. Service accounts provide an identity for processes (applications) that run in a Pod, enabling them to interact with the Kubernetes API securely.</p><p>Crucially, these tokens are <strong>long-lived</strong>: when a service account is created, Kubernetes automatically generates a token and stores it indefinitely as a Secret, which can be mounted into pods and used by applications to authenticate API requests.</p><p>As a reminder, the <strong>Kubelet</strong> on each node is responsible for mounting service account tokens into pods, so they can be used by applications within those pods to authenticate to the Kubernetes API when needed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VtVsPdm1bjI1PFfM40oIzA.png" /></figure><p>If you need a refresher on K8s components, look <a href="https://blog.gitguardian.com/hardening-your-k8-pt-1/#:~:text=right%20into%20it.-,1.%20Kubernetes%20Components,-First%2C%20let%27s%20do">here</a>.</p><h3>The Utility of Service Account Tokens</h3><p>Service account tokens are essential for enabling applications running on Kubernetes to interact with the Kubernetes API. They are used to deploy applications, manage workloads, and perform administrative tasks programmatically. For instance, a Continuous Integration/Continuous Deployment (CI/CD) tool like Jenkins would use a service account token to deploy new versions of an application or roll back a release.</p><h3>The Risks of Longevity</h3><p>While service account tokens are indispensable for automation within Kubernetes, their longevity can be a significant risk factor. Long-lived tokens, if compromised, give attackers ample time to explore and exploit a cluster. Once in the hands of an attacker, these tokens can be used to gain unauthorized access, elevate privileges, exfiltrate data, or even disrupt the entire cluster’s operations.</p><p>Here are a few leak scenarios that could lead to some serious damage:</p><p>- <strong>Misconfigured Access Rights</strong>: A pod or container may be misconfigured to have broader file system access than necessary. If a token is stored on a shared volume, other containers or malicious pods that have been compromised could potentially access it.</p><p>- <strong>Insecure Transmission</strong>: If the token is transmitted over the network without proper encryption (like sending it over HTTP instead of HTTPS), it could be intercepted by network sniffing tools.</p><p>- <strong>Code Repositories</strong>: Developers might inadvertently commit a token to a public or private source code repository. If the repository is public or becomes exposed, the token is readily available to anyone who accesses it.</p><p>- <strong>Logging and Monitoring Systems</strong>: Tokens might get logged by applications or monitoring systems and could be exposed if logs are not properly secured or if verbose logging is accidentally enabled.</p><p>- <strong>Insider Threat</strong>: A malicious insider with access to the Kubernetes environment could extract the token and use it or leak it intentionally.</p><p>- <strong>Application Vulnerabilities</strong>: If an application running within the cluster has vulnerabilities (e.g., a Remote Code Execution flaw), an attacker could exploit this to gain access to the pod and extract the token.</p><h3>How Could an Attacker Exploit Long-Lived Tokens?</h3><p>Attackers can collect long-lived tokens through network eavesdropping, exploiting vulnerable applications, or leveraging social engineering tactics. With these tokens, they can manipulate Kubernetes resources at their will. Here is a non-exhaustive list of potential abuses:</p><p>- Abuse the cluster’s (often barely limited) infra resources for <strong>cryptocurrency mining</strong> or as part of a botnet.</p><p>- With API access, attackers could <strong>deploy malicious containers</strong>, alter running workloads, exfiltrate sensitive data, or even take down the entire cluster.</p><p>- If the token has broad permissions, it can be used to modify roles and bindings to <strong>elevate privileges</strong> within the cluster.</p><p>- The attacker could create additional resources that provide them with persistent access ( <strong>backdoor</strong>) to the cluster, making it harder to remove their presence.</p><p>- Access to sensitive data stored in the cluster or accessible through it could lead to <strong>data theft or leakage</strong>.</p><h3>Why Aren’t Service Account Tokens Short-Lived by Default?</h3><p><a href="https://blog.gitguardian.com/a-maturity-model-for-secrets-management/">Short-lived tokens are a security best practice in general</a>, particularly for managing access to very sensitive resources like the Kubernetes API. They reduce the window of opportunity for attackers to exploit a token and facilitate better management of permissions as application access requirements change. Automating token rotation limits the impact of a potential compromise and aligns with the principle of least privilege-granting only the access necessary for a service to operate.</p><p>The problem is that implementing short-lived tokens comes with some overhead.</p><p>First, implementing short-lived tokens typically requires a <strong>more complex setup</strong>. You need an automated process to handle token renewal before it expires. This may involve additional scripts or Kubernetes operators that watch for token expiration and request new tokens as necessary.</p><p>This often means integrating a <strong>secret management system</strong> that can securely store and automatically rotate the tokens. This adds a new dependency for system configuration and maintenance.</p><p>Second, software teams running their CI/CD workers on top of the cluster will need adjustments to support dynamic retrieval and injection of these tokens into the deployment process. This could require changes in the pipeline configuration and additional error handling to manage potential token expiration during a pipeline run, which can be a true headache.</p><p><strong>And secrets management is just the tip of the iceberg.</strong> You will also need monitoring and alerts if you want to troubleshoot renewal failures. Fine-tuning token expiry time could break the deployment process, requiring immediate attention to prevent downtime or deployment failures.</p><p>Finally, there could also be performance considerations, as many more API calls are needed to retrieve new tokens and update the relevant Secrets.</p><p>By default, Kubernetes opts for a straightforward setup by issuing service account tokens without a built-in expiration. This approach simplifies initial configuration but lacks the security benefits of token rotation. It is the Kubernetes admin’s responsibility to configure more secure practices by implementing short-lived tokens and the necessary infrastructure for their rotation, thereby enhancing the cluster’s security posture.</p><h3>Mitigation Best Practices</h3><p>For many organizations, the additional overhead is justified by the security improvements. Tools like service mesh implementations (e.g., <a href="https://istio.io/latest/about/service-mesh/?ref=blog.gitguardian.com">Istio</a>), secret managers (e.g., <a href="https://docs.cyberark.com/conjur-enterprise/latest/en/Content/Integrations/k8s-ocp/k8s-architecture.htm?ref=blog.gitguardian.com">CyberArk Conjur</a>), or cloud provider services can manage the lifecycle of short-lived certificates and tokens, helping to reduce the overhead.</p><p>Additionally, recent versions of Kubernetes offer features like the <a href="https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/token-request-v1/?ref=blog.gitguardian.com">TokenRequest</a> API, which can automatically rotate tokens and project them into the running pods.</p><p>Even without any additional tool, you can mitigate the risks by limiting the Service Account auto-mount feature. To do so, you can opt out of the default API credential automounting with a single flag in the service account or pod configuration. Here are two examples:</p><ul><li>For a Service Account:</li></ul><pre>apiVersion: v1<br>kind: ServiceAccount<br>metadata:<br> name: build-robot<br>automountServiceAccountToken: false<br>…</pre><ul><li>And for a specific Pod:</li></ul><pre>apiVersion: v1<br>kind: Pod<br>metadata:<br> name: my-pod<br>spec:<br> serviceAccountName: build-robot<br> automountServiceAccountToken: false<br> …</pre><p>The bottom line is that <strong>if an application does not need to access the K8s API, it should not have a token mounted.</strong> This also limits the number of service account tokens an attacker can access if the attacker manages to compromise any of the Kubernetes hosts.</p><p>Okay, you might say, but how do we enforce this policy everywhere? Enter Kyverno, a policy engine designed for K8s.</p><h3>Enforcement with Kyverno</h3><p>Kyverno allows cluster administrators to manage, validate, mutate, and generate Kubernetes resources based on custom policies. To prevent the creation of long-lived service account tokens, one can define the following Kyverno policy:</p><pre>apiVersion: kyverno.io/v1<br>kind: ClusterPolicy<br>metadata:<br>  name: deny-secret-service-account-token<br>spec:<br>  validationFailureAction: Enforce<br>  background: false<br>  rules:<br>  - name: check-service-account-token<br>    match:<br>      any:<br>      - resources:<br>          kinds:<br>          - Secret<br>    validate:<br>      cel:<br>        expressions:<br>        - message: &quot;Long lived API tokens are not allowed&quot;<br>          expression: &gt;<br>            object.type != &quot;kubernetes.io/service-account-token&quot;<br></pre><p>This policy ensures that only Secrets that are not of type kubernetes.io/service-account-token can be created, effectively blocking the creation of long-lived service account tokens!</p><h3>Applying the Kyverno Policy</h3><p>To apply this policy, you need to have Kyverno installed on your Kubernetes cluster (<a href="https://kyverno.io/docs/installation/methods/?ref=blog.gitguardian.com">tutorial</a>). Once Kyverno is running, you can apply the policy by saving the above YAML to a file and using kubectl to apply it:</p><pre>kubectl apply -f deny-secret-service-account-token.yaml</pre><p>After applying this policy, any attempt to create a Secret that is a service account token of the prohibited type will be denied, enforcing a safer token lifecycle management practice.</p><h3>Wrap up</h3><p>In Kubernetes, managing the lifecycle and access of service account tokens is a critical aspect of cluster security. By preferring short-lived tokens over long-lived ones and enforcing policies with tools like Kyverno, organizations can significantly reduce the risk of token-based security incidents. Stay vigilant, automate security practices, and ensure your Kubernetes environment remains robust against threats.</p><p><em>Originally published at </em><a href="https://blog.gitguardian.com/understanding-the-risks-of-long-lived-kubernetes-service-account-tokens/"><em>https://blog.gitguardian.com</em></a><em> on January 11, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=07f10e866ef2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gitguardian/understanding-the-risks-of-long-lived-kubernetes-service-account-tokens-07f10e866ef2">Understanding the Risks of Long-Lived Kubernetes Service Account Tokens</a> was originally published in <a href="https://medium.com/gitguardian">GitGuardian</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI and Cybersecurity in 2024 — What’s Changing and Why It Matters]]></title>
            <link>https://medium.com/gitguardian/ai-and-cybersecurity-in-2024-whats-changing-and-why-it-matters-755eb4c97226?source=rss-58fcd5704426------2</link>
            <guid isPermaLink="false">https://medium.com/p/755eb4c97226</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[predictions]]></category>
            <category><![CDATA[2024]]></category>
            <dc:creator><![CDATA[Thomas Segura]]></dc:creator>
            <pubDate>Wed, 20 Dec 2023 09:11:56 GMT</pubDate>
            <atom:updated>2024-01-29T10:21:38.356Z</atom:updated>
            <content:encoded><![CDATA[<h3>AI and Cybersecurity in 2024 — What’s Changing and Why It Matters</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*K2aBGYp558tqApVd.png" /></figure><p>As 2024 unfolds, the cybersecurity landscape is witnessing a notable transformation, primarily driven by the increasing integration of Artificial Intelligence (AI). Here’s a deeper dive into what these changes entail and their significance in the cyber world.</p><p>One of the most significant changes we’re seeing is in the <a href="https://www.sec.gov/corpfin/secg-cybersecurity?ref=blog.gitguardian.com">regulatory framework governing cybersecurity</a>. Public companies are now required to report cybersecurity incidents within just four business days, marking a significant shift in corporate governance and cybersecurity management. This new mandate is reshaping how businesses approach cybersecurity, with a strong emphasis on compliance and proactive management of cybersecurity risks.</p><p>In parallel, the EU has taken a pioneering step by passing <a href="https://www.technologyreview.com/2023/12/11/1084942/five-things-you-need-to-know-about-the-eus-new-ai-act?ref=blog.gitguardian.com">the first regulation specifically targeting AI technology</a>. Although it might seem early, the groundwork for this law began back in 2021, and it has since been refined for the realities of a post-ChatGPT world. The AI Act establishes the EU as a leader in coordinating compliance, implementation, and enforcement of AI regulations.</p><p>The act sets mandatory regulations for AI, focusing particularly on foundation models. These are the most powerful systems, like GPT-4, Claude, or Gemini, developed using extensive datasets that may include billions of items, some of which could be subject to copyright. Given their potential impact, these models will face heightened scrutiny, particularly in terms of security.</p><p>Echoing the influence of the General Data Protection Regulation (GDPR), the AI Act is poised to become a global benchmark for AI regulation. The EU’s proactive stance in this area demonstrates its ambition to be the world’s leading tech regulator, potentially influencing global standards in AI governance.</p><h4>AI’s Dual Role in Cybersecurity</h4><p>The role of AI in cybersecurity is a complex one. On one hand, AI technologies offer enhanced protection for systems and data. They allow for more sophisticated and efficient security measures. On the other hand, they introduce new kinds of <a href="https://blog.gitguardian.com/yes-github-copilot-can-leak-secrets/">risks</a> and <a href="https://blog.gitguardian.com/chatgpt-security-concern/">vulnerabilities</a>. This duality is at the heart of strategic planning for CISOs and CSOs, who now have to consider both the advantages and the potential threats posed by AI. Balancing these aspects is crucial for developing effective cybersecurity strategies.</p><h4>The Evolution and Scrutiny of AI Developer Tools</h4><p>AI-based tools like Copilot and CodeWhisperer are revolutionizing the way developers work, significantly boosting productivity. However, these tools often bypass traditional security practices, potentially leading to new vulnerabilities. In response to this, we expect to see the emergence of oversight tools specifically aimed at scrutinizing and enhancing the security and quality of AI-generated code. This development is crucial in maintaining the balance between efficiency and security in software development.</p><h4>The Rising Importance of Generative AI in Cybersecurity Products</h4><p>Generative AI is quickly becoming an integral part of cybersecurity solutions. Its transition from an optional feature to a core component in both B2B and B2C cybersecurity products reflects the growing reliance on AI for advanced threat detection and response mechanisms. This trend will probably only get stronger next year, as we are yet to see LLM-first products claim superior workflows compared to traditional products.</p><h4>The Evolving Responsibilities of CISOs</h4><p>The responsibilities of Chief Information Security Officers (CISOs) are changing quickly due to an increasing attack surface and the need for ongoing security vigilance. With new regulations aiming to accurately reflect the cost of cyber risks in market dynamics, CISOs are under greater pressure to be proactive in risk identification and mitigation. This heightened focus is also a response to the board’s growing demand for a transparent and accurate understanding of the organization’s actual security stance. The ongoing SEC vs SolarWinds case, dubbed as <a href="https://danielmiessler.com/p/sec-vs-solarwinds-cybersecuritys-enron-moment?ref=blog.gitguardian.com">the ‘Enron moment’ of cybersecurity</a>, should definitely make a turning point.</p><h4>AI, Open-Source, and Compliance</h4><p>The integration of AI in cybersecurity brings to the fore the challenge of managing open-source software in compliance with new regulations. This challenge is reminiscent of the complexities faced in the implementation of the <a href="https://blog.gitguardian.com/are-the-fears-about-the-eu-cyber-resilience-act-justified/">EU’s Cyber Resilience Act</a>. As regulations become more stringent, the task of ensuring that AI and open-source software meet these new standards becomes increasingly significant and complex.</p><h4>In Conclusion: Striking a Balance in 2024</h4><p>In summary, 2024 is a pivotal year in the field of cybersecurity, with AI playing a central role. The key to success in this evolving landscape lies in finding a balance — leveraging AI for innovation and enhanced security, while also navigating the challenges of new regulations and the inherent risks of AI technologies. It’s a delicate balancing act, but one that is crucial for building a secure and resilient digital future.</p><p><em>Originally published at </em><a href="https://blog.gitguardian.com/ai-and-cybersecurity-in-2024-whats-changing-and-why-it-matters/"><em>https://blog.gitguardian.com</em></a><em> on December 20, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=755eb4c97226" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gitguardian/ai-and-cybersecurity-in-2024-whats-changing-and-why-it-matters-755eb4c97226">AI and Cybersecurity in 2024 — What’s Changing and Why It Matters</a> was originally published in <a href="https://medium.com/gitguardian">GitGuardian</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dynamic Application Security Testing: Benefits, Pitfalls, and Top Open-Source Solutions]]></title>
            <link>https://medium.com/gitguardian/dynamic-application-security-testing-benefits-pitfalls-and-top-open-source-solutions-14b876a313b5?source=rss-58fcd5704426------2</link>
            <guid isPermaLink="false">https://medium.com/p/14b876a313b5</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[appsec]]></category>
            <category><![CDATA[devsecops]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[dast]]></category>
            <dc:creator><![CDATA[Thomas Segura]]></dc:creator>
            <pubDate>Thu, 07 Dec 2023 14:11:59 GMT</pubDate>
            <atom:updated>2023-12-21T07:36:15.297Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3wBs-SGt6vMeDSa_EvLfEQ.png" /></figure><h4>by Quentin Lieumont, DevSecOps engineer at Escape | <a href="https://www.linkedin.com/in/quentinlieumont/?ref=blog.gitguardian.com"><strong>LinkedIn</strong></a><strong> | </strong><a href="https://github.com/QuentinN42?ref=blog.gitguardian.com"><strong>GitHub</strong></a></h4><p>Let’s face it — vulnerabilities are often discovered when it’s already too late.</p><p>That’s because many engineers still adopt a security approach, addressing vulnerabilities after data breaches occur. More often than not, these breaches originate from external sources. According to <a href="https://www.verizon.com/business/resources/Tce/reports/2023-data-breach-investigations-report-dbir.pdf?ref=blog.gitguardian.com">Verizon’s 2023 report</a>, 83% of breaches involved external actors like lone hackers or criminal groups. The three primary ways in which attackers access an organization are stolen credentials, phishing, and exploitation of vulnerabilities.</p><p>That’s where DAST tools can step into your proactive security strategy. DAST tools act like real-world hackers. They interact with applications like someone from the outside would, helping you secure your applications before it’s being attacked by others. DAST goes beyond checking an application’s internal state; it extends to testing its external environment.</p><p>But like every security tool out there, DAST tools do not come without limitations. How impactful are they, though? We’ll answer this question — and more — in this article.</p><p>We’ll challenge common perceptions of DAST, discuss real-world scenarios, and show you the best Open Source DAST tools that you can integrate into your automated secure pipelines (Hello DevSecOps!).</p><h3>Why DAST complements SAST</h3><p>Dynamic application security testing isn’t a new concept. In reality, there are many tools and companies that entered this space years ago.</p><p>And it’s not the only application security solution out there. In fact, <a href="https://www.synopsys.com/content/dam/synopsys/sig-assets/reports/rep-DSO-23-global.pdf?ref=blog.gitguardian.com">most DevSecOps</a> would agree that successful DevSecOps teams must use a full security toolset-including DAST and static application security testing (SAST)-to address code quality and security flaws throughout the SDLC.</p><p><a href="https://blog.gitguardian.com/why-sast-dast-cant-be-enough/">SAST and DAST use different testing approaches:</a></p><ul><li>SAST tests applications by reviewing their source code</li><li>DAST simulates real-world attack scenarios against the running application</li></ul><p>By combining these together, the developers and security teams can have access to a wider range of the detected vulnerabilities, along with detailed remediation guidance for each (While a StackOverflow thread might be your best friend, it’s not always the most reliable and efficient).</p><p>According to Escape’s <a href="https://escape.tech/resources/state-of-public-apis-2023/?ref=blog.gitguardian.com">State of APIs 2023</a> security report, 87% of 6k+ public APIs were vulnerable due to an easily exploitable misconfiguration with severe business impact ( <a href="https://owasp.org/API-Security/editions/2023/en/0xa8-security-misconfiguration/?ref=blog.gitguardian.com">API8:2023 OWASP Security Misconfiguration</a>). Up to 12% had more serious vulnerabilities like injections, so combining your security solutions to protect your organization’s applications is no longer a nice-to-have, but a must.</p><p>DAST excels in identifying runtime vulnerabilities such as server configuration errors, authentication flaws, session management issues, cross-site request forgery, and other runtime flaws, which can be difficult or impossible to reproduce with SAST tools.</p><h3>Real-world scenarios where DAST shines</h3><p>Now that we have introduced the theory, let’s get back to reality.</p><p>Exploitable vulnerabilities can translate to substantial financial losses, reputational damage, and the exposure of highly sensitive data (not to mention additional fines that could result from non-compliance with regulations like PSI-DSS or HIPAA). Sectors such as finance and healthcare are particularly at risk in this matter. Let’s take a look at three examples of how using DAST tools could be beneficial in both cases.</p><h3>Addressing session management issues</h3><p>As mentioned before, DAST is great at detecting session management issues.</p><p>But how does it work? DAST will attempt to manipulate session tokens or cookies to test the application’s capacity to protect session information. This helps prevent attackers from hijacking user sessions and getting access to either patient’s or private financial data.</p><h3>Finding authentication and authorization flaws</h3><p>Does your bank have strong authentication policies in place? Or is it still 2014 <a href="https://www.computerworld.com/article/2862675/twofactor-authentication-oversight-led-to-jpmorgan-breach-investigators-reportedly-found.html?ref=blog.gitguardian.com">with JP Morgan and no MFA</a>? That’s where DAST will be your best friend — it will check if the application enforces strong password policies and correctly handles account lockouts. More than that, it’ll assess whether authorization checks are in place to prevent unauthorized access to sensitive financial information.</p><h3>Data encryption during transmission</h3><p>Clear transmission of sensitive data often leads to a vulnerability that is surprisingly prevalent, impacting even the largest of corporations.</p><p>In healthcare, sensitive patient data (like medical records) are transmitted between the user’s device and the server. If this communication is not encrypted, an attacker with the capability to intercept the traffic (eavesdrop) could potentially access and view the patient’s medical information. This is especially risky when communication occurs over insecure channels, such as unencrypted HTTP connections.</p><p>How to be sure that sensitive data is always encrypted during transmission? In most cases, you can’t. DAST is here to help. DAST applications, when assessing data encryption during transmission, simulate potential attacks where they attempt to intercept and manipulate the data in transit.</p><h3>What are the common challenges DAST users face?</h3><blockquote>The trend currently growing is “shift left.” And a lot of times people tend to overly focus on the left side of the SDLC and not enough on the right-hand side of the SDLC. And you can see it in the vendors. So the DAST tools usually tend to be very inefficient and they tend to not produce anything useful neither for the organization nor for security engineers. — <strong>Aleksandr Krasnov, principal security engineer at Meta on </strong><a href="https://www.youtube.com/@the-elephant-in-appsec?ref=blog.gitguardian.com"><strong>the Elephant in AppSec podcast</strong></a></blockquote><p>As with any security tool, DAST tools do come without limitations. And <strong>efficiency</strong> is one of them. DAST scans can take a long time to complete, especially when dealing with large and complex applications. Scanning every aspect of an application’s surface can lead to extended testing periods, potentially delaying development timelines. It also makes it difficult to run scans on a regular basis.</p><p><strong>False positives</strong> are another common pitfall in security scanners. They can lead to wasted time and resources investigating and remedying a non-issue. It can also create a sense of “security fatigue” — if you’re constantly seeing warnings about potential vulnerabilities, you may start to feel like your efforts to secure your applications are worthless.</p><blockquote>It’s the responsibility of the security engineer to identify and prioritize what’s needed. But it takes a security engineer to be somewhat of a software developer, so to speak, to get the idea of what’s needed, be able to do the risk assessment, and being able to do and call out the specific actions. So it’s not really about how to make DAST more efficient. It’s more about how to make the engineering team succeed. — <strong>Aleksandr Krasnov, principal security engineer at Meta on </strong><a href="https://www.youtube.com/@the-elephant-in-appsec?ref=blog.gitguardian.com"><strong>the Elephant in AppSec podcast</strong></a></blockquote><p>Lastly, DAST tools can be <strong>less actionable</strong>, contrary to SAST or SCA tools, even if they generate thousands of alerts. Your engineering team wouldn’t appreciate a generic explanation with five paragraphs from OWASP’s documentation provided by some of the existing DAST tools.</p><p>On one hand, it becomes the responsibility of a security engineer to provide contextualized information for the development team and drive them towards better practices. On the other hand, if you’re choosing a high-quality DAST tool, you’ll benefit from a detailed description of the alert and actionable code remediation snippets so the developer will know exactly where and how to fix it.</p><p>Now, let’s take a look at examples of some tools you can use.</p><h3>Top Open Source DAST Tools</h3><p>There are several open-source DAST tools available to start testing your applications at runtime without committing straight away to more advanced solutions. Open-source tools usually come with strong community support, including extensive documentation, user forums, and active development. These resources can be essential for troubleshooting and staying updated with the latest security practices.</p><h3>ZAP (formerly known as OWASP ZAP)</h3><p>ZAP is a well known open-source DAST tool used for finding a variety of security vulnerabilities in web applications. Security professionals and developers alike widely use it for its comprehensive features and flexibility. The ZAP core project is accessible via GitHub Repo: <a href="https://github.com/zaproxy/zaproxy?ref=blog.gitguardian.com">zaproxy/zaproxy</a>.Getting started with Zap is easy, but might require some customization along the way. You can follow the <a href="https://www.zaproxy.org/getting-started/?ref=blog.gitguardian.com">getting started documentation</a>. It has a basic graphic user interface where you can set up your scans and view results:</p><p><strong>Pros and cons of ZAP:</strong> As a former OWASP project, ZAP benefits from strong community support, offering extensive documentation, a wide range of add-ons, and an active user base for troubleshooting. It can be integrated into CI/CD pipelines, allowing you to benefit from automated security testing as well.</p><p>While ZAP is a powerful tool, it can be overwhelming for newcomers to web application security. Its UI is quite outdated and may require some customization before it is comfortable to use. Automated scanning capabilities are limited compared to the paid tools and performing comprehensive scans can be resource-intensive for the application, and scans can take a long time to complete. However, given ZAP’s well-established reputation in the community, there are ways to reduce scan time. For a step-by-step guide on improving ZAP’s performance, you can refer to the <a href="https://blog.mozilla.org/security/2013/07/10/how-to-speed-up-owasp-zap-scans/?ref=blog.gitguardian.com">Mozilla security blog</a>.</p><p><strong>In summary, ZAP is for you if:</strong></p><ul><li>You need an extensive open-source security testing tool</li><li>You require both automated scanners and tools for manual testing.</li><li>You are rather an experienced security professional.</li><li>Features like automated scanners, intercepting proxies, and comprehensive reporting are important to you.</li></ul><h3>SQLMap</h3><p>SQLMap is a specialized open-source DAST tool that automates detecting and exploiting SQL injection flaws and taking over database servers. It has a powerful detection engine and offers a variety of features, making it a go-to tool for penetration testers and developers concerned with SQL injection security.</p><p>You can find it on GitHub here: <a href="https://github.com/sqlmapproject/sqlmap?ref=blog.gitguardian.com">sqlmapproject/sqlmap</a></p><p>The SQLMap website provides a good overview of the tool in action. If you’re a visual learner, you can check out their demos on YouTube as well.</p><p><strong>Pros and cons of SQLMap:</strong> SQLMap stands out for its laser-focused functionality in detecting and exploiting SQL injection vulnerabilities. Its automated detection engine saves significant time and effort, making it a highly efficient tool for database security assessments. The efficiency and depth of SQLMap’s analysis are unmatched in its specific area of expertise, providing users with detailed insights into potential database vulnerabilities.</p><p>However, SQLMap’s specialization also comes with limitations. Its primary focus on SQL injection means it does not address a broader spectrum of web application vulnerabilities, which could require the use of additional tools for comprehensive security testing. If not used with the necessary expertise and caution, SQLMap can potentially impact the performance and stability of the targeted database. It requires a careful and knowledgeable approach to avoid unintended consequences during testing.</p><p><strong>To recap, SQLMap is for you if:</strong></p><ul><li>You are focused on detecting and exploiting SQL injection vulnerabilities.</li><li>You need a tool that supports a wide range of database management systems.</li><li>Tasks like fingerprinting the database, extracting data, and gaining shell access are important to you.</li></ul><h3>Nikto</h3><p>Nikto is a popular open-source DAST tool that performs comprehensive tests against web servers for multiple items, including dangerous files/CGIs, outdated server software, and other problems.</p><p>Its GitHub Repo can be found here: <a href="https://github.com/sullo/nikto?ref=blog.gitguardian.com">sullo/nikto</a></p><p>To test it, you can simply run the following inside a docker container:</p><pre>$ docker run frapsoft/nikto -host https://my.server.com/ - Nikto v2.1.5 --------------------------------------------------------------------------- + Target IP: X.X.X.X + Target Hostname: my.server.com + Target Port: 443 + Start Time: 2023-11-17 11:39:53 (GMT0) --------------------------------------------------------------------------- + Server: No banner retrieved + The anti-clickjacking X-Frame-Options header is not present. + ... + End Time: 2023-11-17 11:41:05 (GMT0) (72 seconds) --------------------------------------------------------------------------- + 1 host(s) tested</pre><p><strong>Pros and cons of Nikto:</strong> Nikto is well-known for its speed and efficiency in scanning web servers. It excels in quickly identifying common vulnerabilities (like XSS and SQL injections) and server configuration issues, making it an excellent tool for rapid assessments. Nikto is regularly updated to detect the latest known vulnerabilities and server misconfigurations. It now has more than 6,700 vulnerabilities in its database and ensures that users are always equipped with up-to-date security scanning capabilities. It can also guess the subdomains of the scanned domain.</p><p>On the downside, Nikto focuses primarily on web server vulnerabilities. It does not provide a comprehensive scan of the complete web application, including the business logic or deeper application-level flaws. This narrower scope can be a limitation for users seeking a more holistic web application security assessment. Still, it can be supplemented with other tools to achieve a more comprehensive analysis.</p><p>In addition, Nikto is also not very user-friendly, lacking a graphical user interface and operating solely from the command line. You can’t know whether your scan is still being executed or completely stuck. This can be a daunting experience for security engineers less acquainted with development, especially considering some users’ complaints about the lack of support or a well-developed community that exists with OWASP ZAP.</p><p><strong>Nikto is for you if:</strong></p><ul><li>You need a straightforward and versatile web server scanner.</li><li>You want a tool that quickly scans web servers and provides detailed reports that can be exported as plain text, XML, HTML, and CSV format.</li><li>You’re already using Kali Linux</li></ul><h3>Conclusion</h3><p>When it comes to website security, there are two main options: paid tools or open-source tools. So, you can ask yourself, which is better?</p><p>The most important is to understand how the tool exactly works. Would you be able to perform all the things you need for web apps as an external entity? Is it scalable and can easily be integrated into your SDLC?</p><p>Open-source DAST tools are free and usually have large community support. Paid tools tend to be more comprehensive and offer more features. A high-quality paid tool will provide almost no false positives, actionable remediation code snippets for developers, and faster scanning times.</p><p>We do believe that the future of DAST tools is customization. Each application is different and operates in a different business context. In the end, it’s the security engineer who needs to implement the most precise and custom tests based on their application needs. The next generation of DAST tools must provide them the ability to do just that.</p><p><em>Originally published at </em><a href="https://blog.gitguardian.com/dynamic-application-security-testing-benefits-pitfalls-and-top-open-source-solutions/"><em>https://blog.gitguardian.com</em></a><em> on December 7, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14b876a313b5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gitguardian/dynamic-application-security-testing-benefits-pitfalls-and-top-open-source-solutions-14b876a313b5">Dynamic Application Security Testing: Benefits, Pitfalls, and Top Open-Source Solutions</a> was originally published in <a href="https://medium.com/gitguardian">GitGuardian</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Are the Fears about the EU Cyber Resilience Act Justified?]]></title>
            <link>https://medium.com/gitguardian/are-the-fears-about-the-eu-cyber-resilience-act-justified-01ca1fb33ae7?source=rss-58fcd5704426------2</link>
            <guid isPermaLink="false">https://medium.com/p/01ca1fb33ae7</guid>
            <category><![CDATA[european-union]]></category>
            <category><![CDATA[policies-regulations]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Thomas Segura]]></dc:creator>
            <pubDate>Fri, 01 Dec 2023 15:53:57 GMT</pubDate>
            <atom:updated>2023-12-13T15:49:58.418Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jeONTap1_k8JS6We776GPw.png" /></figure><p>On Wednesday, July 19, the European Parliament voted in favor of a major new legal framework regarding cybersecurity: the <strong>Cyber Resilience Act (CRA)</strong>.</p><p>According to the press release following the vote:</p><blockquote><em>“The draft cyber resilience act approved by the Industry, Research and Energy Committee aims to ensure that products with digital features, e.g. phones or toys, are secure to use, resilient against cyber threats and provide enough information about their security properties.”</em></blockquote><p>This choice of examples, mundane as they may seem, subtly underscores a critical debate surrounding the CRA: its broad scope of application. While some may question the inclusion of such commonplace items, it reflects the Act’s comprehensive approach to cybersecurity.</p><p>The CRA’s introduction is timely and vital. It represents a concerted effort to enhance the resilience of digital products against cyber threats, demanding international collaboration and strategic foresight. This initiative is a significant stride in bolstering EU’s cyber defense and asserting its digital sovereignty.</p><p>For context, the European Union Agency for Cybersecurity (ENISA) highlights a concerning escalation in both the frequency and complexity of cyberattacks targeting the EU, as detailed in their <a href="https://www.enisa.europa.eu/publications/enisa-threat-landscape-2023?ref=blog.gitguardian.com">Threat Landscape report</a>. Public administration, constituting approximately 19% of these attacks, emerged as the most vulnerable sector in 2022 and 2023.</p><h3>Decoding the Cyber Resilience Act: How Will It Work?</h3><p>The CRA’s main objective is to <strong>establish a universal cybersecurity baseline</strong> for all products with digital components sold within the EU. This encompasses a wide array of items, from software and network-connectable devices to items containing embedded computing systems. Significantly, the Act does not differentiate between consumer and enterprise-grade products.</p><p>To manage this diverse range of products, the Act proposes a categorization into three security tiers: the default category, critical “Class I”, and “Class II”. According to the EU Commission, it is anticipated that a majority (around 90%) of products will fall under the ‘default category’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/0*9NH38XzwvuH6EdZn.png" /></figure><p>Based on this product categorization, the CRA introduces differentiated levels of security assessments. Most notably, “ <strong>critical software</strong>” demands rigorous third-party evaluation. However, the categorization’s scope is not always straightforward. Consider the example of hard drives: while generally classified under the default category, ambiguity arises when these hard drives are employed in cloud data centers handling sensitive data. <strong>This grey area highlights the need for more nuanced guidelines within the Act.</strong></p><p>One aspect of the CRA that stands out is its stringent approach to enforcement through substantial financial penalties. <strong>Vendors operating in the EU single market face fines up to €15 million or 2.5% of their global revenue for non-compliance.</strong> This measure reflects a shift in perspective, treating security as a fundamental, non-negotiable aspect of product development, rather than a secondary consideration.</p><p>This emphasis on financial accountability is a strategic move by the EU. By assigning a tangible cost to cybersecurity risks — costs that some companies have historically been willing to absorb — the CRA aims to recalibrate the risk-reward equation in favor of enhanced security measures.</p><p>But this raises another fundamental question: who in the supply chain should be held accountable? Or said differently, who bears the risk?</p><h3>Who Bears the Risk? The CRA’s Stance on Responsibility</h3><p>The CRA is unequivocal in assigning responsibility for digital product security: the onus lies with the manufacturers. In cases where the manufacturer and software producer are the same, this is straightforward. <strong>However, the act enters murky waters when it comes to open-source software.</strong> Defining security ownership for code written by one and reused by another presents a complex challenge.</p><p>As a reminder, open-source is a pillar of modern software. It typically accounts for 70% to 90% of code in Web and cloud applications — application security firm Synopsys found that 98% of applications analyzed using its service included open-source software, and <a href="https://www.darkreading.com/application-security/dependency-problems-increase-for-open-source-components?ref=blog.gitguardian.com">75% of the average codebase came from open-source projects</a>. They also found that, on average, a software application relied on more than 500 open-source dependencies.</p><p>This underscores the significant challenge faced by nearly every commercial business in conducting necessary due diligence. They should ensure that all open-source components have been accurately evaluated.</p><h3>Reactions from the Open-Source Community</h3><p>The primary worry comes directly from the open-source community itself. Many prominent open-source projects express concern because the Cybersecurity Act appears to suggest that the responsibility of compliance should fall on the shoulders of open-source developers. <strong>This implies that if any commercially sold software in the EU market incorporates an open-source component, its creators could be held accountable for its security.</strong></p><p>This literal interpretation could potentially create an unsustainable situation for those contributing to open-source projects.</p><p>However, it’s important to note that the CRA does specifically exempt open-source software that is developed or supplied outside of commercial activities. <strong>The issue, though, seems to lie in how the CRA defines open-source activity</strong>. The act seems to be permeated with the notion that most open-source activity stems from “benevolent work,” a perspective that is largely considered out-of-date in today’s context.</p><p>As an example, projects receiving donations or with corporate contributors would not be considered benevolent work and fall under the act’s purview. But this view couldn’t be further from the reality: open-source and commercial activities are often intertwined in complex hybrid operating profiles. Many open-source companies are developing open-source products with permissive licenses, while they monetize their activity through the selling of support services and premium features.</p><p>Conversely, it is not uncommon for tech giants to employ full-time engineers to work exclusively on some of the biggest open-source projects.</p><p>This highlights a significant misalignment between EU lawmakers and the open-source community. Key players in the open-source field, such as OpenSSF and the Debian Foundation, have criticized the legislators for failing to consult them during the drafting of the act.</p><h3>The Future of Open-Source Under the CRA</h3><p><strong>Despite prevailing concerns, it’s unlikely that the Cyber Resilience Act will signal the end of open-source software in the European Union. </strong>It’s true that current versions of the CRA, don’t explicitly define its scope. However, this doesn’t preclude the possibility of future amendments.</p><p>The potential upheaval caused by mandating every software producer to scrutinize all its open-source components is simply too vast. We anticipate that the largest industry enterprises in the single market, all heavily reliant on software, will wield their considerable lobbying power to influence the law in their favor upon recognizing the potentially catastrophic impact. The stakes are too high, and the risk of damaging Europe’s competitive edge is enormous.</p><p>Even if these efforts fail, there may well be grounds to challenge the law in court due to the ambiguities present in the text. Consequently, we can expect to see the language of the law refined in the coming months. Ideally, this will occur through close collaboration with leading open-source organizations.</p><h3>Conclusion: A Regulatory Milestone with Challenges Ahead</h3><p>The Cybersecurity Act (CRA) represents a significant milestone in the European Union’s (EU) regulatory evolution, with the goal of unifying cybersecurity standards across its market. <strong>More than just a regulatory measure, the CRA is a political statement, intentionally timed to demonstrate the EU’s commitment to combating cyber threats.</strong> The Act’s broad scope and rapid implementation schedule can be largely attributed to the current geopolitical turbulence.</p><p>The CRA enforces security measures throughout a product’s lifecycle, compelling manufacturers to prioritize cybersecurity. This bold move is essential for enhancing digital security within the EU. However, the Act’s wide scope and numerous ambiguities have also created concerns. <strong>Are the fears of open-source organizations bearing the burden of security responsibility justified?</strong></p><p>While it is ultimately up to you to form an opinion, we believe that these fears are not entirely justified, although there is some uncertainty. The existence of legal gaps and the potentially significant consequences for the EU economy if the law is strictly enforced in its current state are valid arguments for future refinements. These refinements should aim to enhance, rather than impede, the innovation and resilience that open-source technology brings to the digital landscape. However, achieving this will require vigilance.</p><p>In conclusion, the Cybersecurity Act represents a crucial step towards a more secure digital environment in the EU. While challenges and ambiguities exist, it is essential to strike a balance that encourages innovation while ensuring robust cybersecurity measures.</p><p><em>Originally published at </em><a href="https://blog.gitguardian.com/are-the-fears-about-the-eu-cyber-resilience-act-justified/"><em>https://blog.gitguardian.com</em></a><em> on December 1, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=01ca1fb33ae7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gitguardian/are-the-fears-about-the-eu-cyber-resilience-act-justified-01ca1fb33ae7">Are the Fears about the EU Cyber Resilience Act Justified?</a> was originally published in <a href="https://medium.com/gitguardian">GitGuardian</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Secure by Default: Integrating GitGuardian in Vermeer’s Software Development Lifecycle]]></title>
            <link>https://medium.com/gitguardian/secure-by-default-integrating-gitguardian-in-vermeers-software-development-lifecycle-691709e85cb8?source=rss-58fcd5704426------2</link>
            <guid isPermaLink="false">https://medium.com/p/691709e85cb8</guid>
            <category><![CDATA[secure-coding]]></category>
            <category><![CDATA[devsecops]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[sdlc]]></category>
            <dc:creator><![CDATA[Thomas Segura]]></dc:creator>
            <pubDate>Mon, 20 Nov 2023 15:00:33 GMT</pubDate>
            <atom:updated>2023-12-13T15:28:17.447Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q5CAn1Ui0HqZRLdfmDUjfQ.png" /></figure><p>My name is C.J. May, and I’m a Senior IT Security Analyst at <a href="https://vermeer.com/?ref=blog.gitguardian.com">Vermeer Corporation</a>. We are a manufacturing company for agricultural and industrial machinery. Vermeer has over 3500 employees globally. Of those 3500, about 65 are active developers, and 7 work in cyber security. We write a lot of code for our machines, and we also develop software in-house to support our dealers and our customers. Over the past few years, we’ve overhauled our software development lifecycle (SDLC), and that includes improvements to security.</p><p>Our aim is to make our software <strong>“Secure by Default,”</strong> which means that security isn’t something that gets tacked on at the end of a finished software product — it’s built into our processes at every stage of the SDLC. That way, the end product has already undergone security review before it is even deployed, and we have already captured most of the vulnerabilities.</p><p>There are multiple components to our DevSecOps stack, but I’m here to talk about secret scanning. In this article, I’ll explain which secret scanning tools we tried in the past, the pain points we uncovered, why we switched to GitGuardian, and the value we have gotten since.</p><h3>Where we Started</h3><p>When our software development process started its overhaul, we didn’t have money immediately budgeted for security tools. Open-source scanners were our first solution to identifying secrets in our code. After some testing, we ended up settling on it.</p><p>Gitleaks is a command-line tool that will scan your entire git history for secrets. I liked that the rules in Gitleaks were easily customizable, which enabled me to maintain our own forked ruleset that ignored false positives and added internal detections.</p><p>At the time we started using Gitleaks, they didn’t have any GitHub Actions (they have since created one), so I helped maintain an open-source action that used Gitleaks. I deployed the action to all of our repositories, and we had secret scanning in all of our Pull Requests as well as a historical look back of what we had missed before!</p><h3>Tools vs. Platforms</h3><p>Gitleaks turned out to be a dependable standalone tool, but over time I realized that <strong>there is a lot more to leaked secrets than having a functioning scanner. </strong>First of all, there was quite a bit of work involved in maintaining the custom Gitleaks action. I had to use GitHub’s API to deploy it to all of our repositories. There were also some edge cases that broke it on a few occasions, which led to developer frustration and debugging time on my part.</p><p>The custom action was also completely decentralized, which meant that I had to build out <strong>reporting functionality</strong> so we could review leaks and ensure that they were being taken care of. Another challenge that came from the lack of central management was <strong>dealing with false positives and remediated secrets</strong>. When there were detections that we no longer wanted to see, we used Gitleaks’ .gitleaksignore file. Disabling detections using the file worked fine, but there wasn’t a built-in way to document why a detection was being ignored.</p><p>Another challenge that developed over time was how to handle our <strong>historical leak cleanup</strong>. Prior to using Gitleaks, our codebase’s only secret scanner was our developers’ eyes. This meant that we had some secrets in our code already that needed to be cleaned up. We could go through each one of our 1000+ repositories and run a full history scan with Gitleaks, but that would take a long time, and we would have no way to prioritize and find the most important secrets first.</p><p>Overall, there was a lot of <strong>extra time spent on engineering</strong> in order to support our secret scanning needs with an open-source tool. As time passed, we asked for budget to improve the security of our SDLC. Once that was approved, we decided to improve our secret scanning processes with a comprehensive platform that would be more cohesive and include all the nuts and bolts we were previously engineering ourselves.</p><h3>Evaluating Secret Scanning Platforms</h3><p>Before we set out on our exploration, we did some research and defined success criteria for the platforms we would be evaluating. It’s kind of a long list, but others who are in a similar position may find it helpful, so I am keeping it unredacted:</p><p><a href="https://blog.gitguardian.com/secure-by-default-integrating-end-to-end-security-in-vermeers-software-development-lifecycle/">Secure by Default: Integrating GitGuardian in Vermeer&#39;s Software Development Lifecycle</a></p><p>We evaluated multiple secret scanning products. We also checked out full SAST solutions, and we found that some SAST products could detect exposed secrets. However, they weren’t as accurate, and they would handle a leaked secret like any other discovered vulnerability, which didn’t help us prioritize historical leaks. They also lacked features like validity checks and public leak monitoring.</p><p>In the end, <strong>GitGuardian emerged as the clear leader in the secret scanning space</strong> from a feature perspective. As I’ve already explained, though, features alone aren’t valuable if they don’t enable cohesive processes for the end users. With that in mind, I’ll get into our experience with GitGuardian since we became customers.</p><h3>The Value of GitGuardian</h3><p>GitGuardian’s 350+ secret detectors are the best at identifying secrets without flagging a bunch of things that aren’t actually sensitive. We evaluated other tools that had decent secret scanning as well, but for us, what sets GitGuardian apart is the user experience for everyone involved.</p><p>On the developer side of things, GitGuardian is seamlessly integrated into the tools that our developers already use, such as GitHub Pull Requests and Git pre-commit hooks. GitGuardian has built-in guides so that developers know what to do when a scan detects a secret. They also let you modify the message with your own information or links to documentation. Having tight integrations into existing processes reduces context-switching for our developers, which lets them focus on the things they’d rather be doing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nRF98ZCgm3oCp3bf" /></figure><p>On the management side, GitGuardian has relieved every pain point we previously had when we were patching together our own secret scanning setup with Gitleaks. GitGuardian’s platform centrally monitors all of our repositories in one place, which enables us to keep track of the secrets that have been dealt with. We can also assign leaks to individuals with fine-tuned access policies so they can leave comments and track the leak through to remediation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*33Muc1KZYN4Whw58" /></figure><p>GitGuardian also helped us tackle our historical leak cleanup in an organized and efficient manner. After we scanned all of our GitHub repositories, I went through and tuned our <strong>severity rules</strong>. Now all of the secrets that GitGuardian finds are ranked in a way that is most relevant to our business.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TLR8IOBc2DRLvxjG" /></figure><h3>Conclusion</h3><p>Overall, I’ve been very impressed with the way GitGuardian has performed for an organization of our size and complexity. Not only that; I’ve gotten a lot of engineering time back since we acquired GitGuardian’s internal monitoring. If we had gone with GitGuardian from the beginning, I probably would have saved over 100 hours of setup and maintenance that we put into an open-source solution.</p><p>GitGuardian reduces the burden on your developers and platform engineers by reducing complexity, integrating smoothly into existing processes, and providing exactly what you need, where, and how you expect it. GitGuardian’s platform has already become a valuable part of our DevSecOps SDLC, and we greatly appreciate the time it saves us and the value it provides.</p><p><em>Originally published at </em><a href="https://blog.gitguardian.com/secure-by-default-integrating-end-to-end-security-in-vermeers-software-development-lifecycle/"><em>https://blog.gitguardian.com</em></a><em> on November 20, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=691709e85cb8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gitguardian/secure-by-default-integrating-gitguardian-in-vermeers-software-development-lifecycle-691709e85cb8">Secure by Default: Integrating GitGuardian in Vermeer’s Software Development Lifecycle</a> was originally published in <a href="https://medium.com/gitguardian">GitGuardian</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Secure Your Secrets Manager with GitGuardian Honeytoken]]></title>
            <link>https://medium.com/gitguardian/how-to-secure-your-secrets-manager-with-gitguardian-honeytoken-db20c9664251?source=rss-58fcd5704426------2</link>
            <guid isPermaLink="false">https://medium.com/p/db20c9664251</guid>
            <category><![CDATA[vault]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[secrets]]></category>
            <category><![CDATA[devsecops]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Thomas Segura]]></dc:creator>
            <pubDate>Tue, 31 Oct 2023 14:00:38 GMT</pubDate>
            <atom:updated>2023-12-08T14:28:55.033Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MFkTxPLg0XwXxp1uZZNoUg.png" /></figure><p>Protecting sensitive data is a crucial responsibility for modern businesses. To ensure the security of critical information, organizations utilize various tools and strategies.</p><p>One such tool is a secrets manager, which securely stores and manages sensitive data like passwords, API keys, and encryption keys. Secrets managers offer a centralized and encrypted repository, providing a secure alternative to storing secrets in configuration files or source code. Popular secrets managers include <a href="https://developer.hashicorp.com/vault/tutorials/getting-started/getting-started-install?ref=blog.gitguardian.com">Hashicorp Vault</a>, <a href="https://aws.amazon.com/fr/secrets-manager/?ref=blog.gitguardian.com">AWS Secrets Manager</a>, <a href="https://www.doppler.com/?ref=blog.gitguardian.com">Doppler</a>, and <a href="https://www.cyberark.com/products/secrets-management/?ref=blog.gitguardian.com">CyberArk</a>.</p><p>In this blog, we will explore how GitGuardian Honeytoken can enhance the security of secrets managers by enabling easy and scalable breach detection.</p><h3>Understanding Honeytokens</h3><p>Honeytokens are digital baits designed to lure attackers into a trap. They have no permissions attached and serve as alerts when unauthorized users attempt to use them.</p><p>When a honeytoken is triggered, it alerts you of the intrusion and provides crucial information about the attacker, such as their IP address and user agent. By storing honeytokens in a secure environment like a secrets manager, you can effectively detect and respond to unauthorized access attempts.</p><p>In the upcoming section, we will guide you on how to place a honeytoken in your <strong>Hashicorp Vault</strong> instance, but these guidelines are applicable to any other secrets manager.</p><p>Before we begin, follow the step-by-step instructions below to create your first honeytoken! 👇</p><h3>Enhancing Secrets Manager Security with Honeytokens</h3><p>Hashicorp Vault is a popular secrets manager that securely stores and controls access to sensitive elements in a DevOps environment. While Vault provides advanced security features, the possibility of an instance compromise cannot be completely eliminated.</p><p>Attackers understand the value of compromising a secrets manager, as it can provide them with access to sensitive information and facilitate lateral movement within your system. Integrating GitGuardian Honeytoken with Vault adds an additional layer of security, alerting you to any unauthorized attempts to access your secrets.</p><h3>Integrating GitGuardian Honeytoken with Vault (or any Secrets Manager)</h3><p>Before integrating GitGuardian Honeytoken, ensure that Vault is installed and running in your environment.</p><p><strong>Installing Vault:</strong></p><ul><li>Download the latest version of Vault from the <a href="https://developer.hashicorp.com/vault/tutorials/getting-started/getting-started-install?ref=blog.gitguardian.com">official website</a>.</li><li>Extract the downloaded file in a directory of your choice.</li><li>Add the Vault binary to your system PATH for easy access.</li></ul><p><strong>Configuring Vault:</strong></p><ul><li>Initiate the Vault server with the appropriate configurations for your organization.</li><li>Initialize Vault to create initial tokens and unseal keys that are critical for Vault’s operations.</li></ul><p><strong>Using GitGuardian Honeytoken:</strong></p><ul><li>Sign in to your GitGuardian account and navigate to the <a href="https://dashboard.gitguardian.com/workspace/honeytokens?ref=blog.gitguardian.com">Honeytoken section</a>.</li><li>Create new honeytokens with a descriptive name and description</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pkz0KrOZ1eunuN_8.png" /></figure><h3>Integration Procedure: Step-by-Step Guide</h3><p>Vault supports multiple secret engines, and for simplicity, we will consider the key value (KV) secret engine. This engine is a generic Key-Value store used to store arbitrary secrets within Vault.</p><p>A set of permissions policies will be needed to list, write, and manage secrets through the KV engine. <a href="https://developer.hashicorp.com/vault/tutorials/policies/policies?ref=blog.gitguardian.com">Read more here</a></p><p>First, ensure that your Vault cluster is reachable by running the command:</p><pre>vault status</pre><p>If you get an error message, follow Vault’s <a href="https://developer.hashicorp.com/vault/tutorials/secrets-management/static-secrets?ref=blog.gitguardian.com">Lab Setup instructions here</a>.</p><p>Next, verify that the KV secrets engine is enabled and set to version 2 at the secret/ path. This should be the default configuration if you started a dev server.</p><pre>vault secrets list -detailed Path Type Accessor ... Options Description ---- ---- -------- ------- ----------- cubbyhole/ cubbyhole cubbyhole_9d52aeac ... map[] per-token private secret storage identity/ identity identity_acea5ba9 ... map[] identity store secret/ kv kv_2226b7d3 ... map[version:2] key/value secret storage ...</pre><p>Finally, write the previously generated AWS secret values at the path of your choice:</p><pre>vault kv put secret/aws aws_access_key_id =&quot;AKIA...&quot; \ aws_secret_access_key = &quot;QzfQeV...&quot;</pre><p>If everything went well, you should see this output:</p><pre>====== Secret Path ====== secret/aws ======= Metadata ======= Key Value --- ----- created_time &lt;CREATION_TIME&gt; custom_metadata &lt;nil&gt; deletion_time n/a destroyed false version 1</pre><p>This confirms that your bait credentials have been set. If you receive an email alert about this honeytoken being triggered, you can assume that your secrets manager is compromised.</p><p>Currently, GitGuardian Honeytoken only supports one type of secret: <strong>AWS key.</strong> In the future, more types of secrets will be available, allowing to place them in other Vault engines, like, for example, the SSH or the database secret engine</p><p>You can further <a href="https://docs.gitguardian.com/honeytoken/configure-alerts?ref=blog.gitguardian.com"><strong>configure your alerts</strong></a>to receive instant notifications through custom webhooks, allowing you to customize your alerting workflow.</p><ul><li><strong>Proactive Breach Detection</strong>: By integrating GitGuardian Honeytoken with Vault, you can proactively detect and respond to potential breaches. Honeytokens act as a silent alarm, alerting you when unauthorized users attempt to use them. This allows you to take immediate action and strengthen your system’s security.</li><li><strong>Enhanced Threat Intelligence</strong>: Honeytokens provide valuable information about the actions taken by intruders, such as their IP address and user agent. This information helps you analyze and understand the threat, enabling you to further secure your system and track down the attackers.</li><li><strong>Scalable Solution</strong>: GitGuardian Honeytoken offers a scalable solution for breach detection. You can create and deploy multiple honeytokens, strategically placing them in your secrets manager to effectively deceive attackers. This scalability ensures comprehensive coverage and protection for your critical assets.</li><li><strong>Customizable Alerting Workflow</strong>: GitGuardian Honeytoken allows you to configure custom alerts through webhooks. This flexibility enables you to tailor your alerting workflow according to your specific requirements, ensuring that you receive instant notifications when a breach is detected.</li></ul><h3>Benefits of protecting your Secrets Manager with Honeytokens</h3><p>Taking proactive measures to secure sensitive information is both prudent and essential. There are a number of security benefits of integrating GitGuardian Honeytoken with Vault:</p><h3>Conclusion</h3><p>By securing your secrets manager with GitGuardian Honeytoken, you can significantly enhance the security of your sensitive information. The proactive breach detection, enhanced threat intelligence, easy integration, scalability, and customizable alerting workflow provided by honeytokens make them a valuable addition to your security arsenal. Follow the step-by-step instructions in this blog to get started and protect your critical assets effectively.</p><p>Protect your secret manager today for free</p><p><em>Originally published at </em><a href="https://blog.gitguardian.com/how-to-secure-your-secrets-managers-with-gitguardian-honeytoken/"><em>https://blog.gitguardian.com</em></a><em> on October 31, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db20c9664251" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gitguardian/how-to-secure-your-secrets-manager-with-gitguardian-honeytoken-db20c9664251">How to Secure Your Secrets Manager with GitGuardian Honeytoken</a> was originally published in <a href="https://medium.com/gitguardian">GitGuardian</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HasMySecretLeaked — Building a Trustless and Secure Protocol]]></title>
            <link>https://medium.com/gitguardian/hasmysecretleaked-building-a-trustless-and-secure-protocol-40aec89e568e?source=rss-58fcd5704426------2</link>
            <guid isPermaLink="false">https://medium.com/p/40aec89e568e</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Thomas Segura]]></dc:creator>
            <pubDate>Tue, 17 Oct 2023 11:30:41 GMT</pubDate>
            <atom:updated>2023-11-15T14:55:34.546Z</atom:updated>
            <content:encoded><![CDATA[<h3>HasMySecretLeaked — Building a Trustless and Secure Protocol</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oeE2ZJY5spAabpoC.png" /></figure><p><a href="https://blog.gitguardian.com/announcing-has-my-secret-leaked/"><strong>HasMySecretLeaked</strong></a> is the first free service that allows security practitioners to proactively verify if their secrets have leaked on <a href="http://github.com/?ref=blog.gitguardian.com">GitHub.com</a>. With access to GitGuardian’s extensive database of over 20 million records of detected leaked secrets, including their locations on GitHub, users can easily query and protect their sensitive information. This database is compiled from scanning billions of code files, commits, GitHub gists, and issues since 2017.</p><p><strong>By opening this project to everyone, we strive to enhance secrets protection at scale while acknowledging the responsibility and security challenges involved.</strong></p><p>At GitGuardian, we believe in transparent, accessible and understandable security. This is why we aim to uphold complete transparency regarding the protocols behind HasMySecretLeaked. Our goal is to ensure the service remains resilient against malicious misuse while also fostering a trustless environment: <strong>with HasMySecretLeaked, you can rest assured that your secrets are secure — at no point do we have access to them, so you don’t even need to trust us!</strong></p><p>To support these claims, this blog post dives into the technical choices that went into creating a safe yet pragmatic and easy-to-use protocol. Without further ado, let’s get started.</p><p>HasMySecretLeaked is a highly efficient REST API designed to take a string of characters as input. Its key function is to answer with 100% assurance the critical question — ‘Has my secret leaked?’</p><p>Here is an example request for the fffff input to show you what a typical response looks like:</p><pre>$ curl https://api.hasmysecretleaked.com/v1/prefix/fffff</pre><p>For this input, the HasMySecretLeaked API response’s payload is:</p><pre>&quot;matches&quot;: [ { &quot;hint&quot;: &quot;0ea3b034632487a17ba18e7086156c14cc8eb9993e33aec8e348183044b299b1&quot;, &quot;payload&quot;: &quot;adO72+jWqHstJso2DacOj...&quot; }, { &quot;hint&quot;: &quot;ddf4ef722ca2ec541074811692eff789bf48d963fa28e42d5542edc8e887239c&quot;, &quot;payload&quot;: &quot;sHrlooMIShmf+Oh0yqcYm...&quot; }, ...</pre><p>As you can notice, there is more going on under the hood. To understand how the client uses this information and the API design decisions involved, let’s start from scratch with a naive, insecure, protocol implementation and iterate from there.</p><h3>1. Naive approach</h3><p>In the most straightforward approach, the user would send their secret directly to the API. Problem: the service, aka GitGuardian, would “see” the users’ secrets in cleartext, which is unacceptable.</p><p>So, <em>how can a user know whether their secret is in our database of leaked credentials without sharing their secret with us?</em></p><p>Response: using a hashed version of the secret.</p><h3>2. Hash-based approach</h3><p>Now, let’s imagine the user sends a hashed version of their secret to the API. This is definitely an improvement, as the secret is obfuscated, and the service cannot reverse the hash. There is still a privacy problem, though: by definition, if the hashed secret is present in our database, it implies that its cleartext version was once publicly accessible, indicating that GitGuardian has or had knowledge of it. In other words, the user would be leaking their secret to us. And that’s not acceptable either.</p><p>So, <em>how can we prove GitGuardian has zero-knowledge about the requested secret?</em></p><p>Response: by responding with multiple possibilities.</p><h3>3. Bucket-based approach</h3><p>In this approach, the user only sends a fragment of their secret’s hash — specifically, the initial 5 characters. The service then retrieves all secrets it holds that align with these five characters. By ensuring the response ‘bucket’ is sufficiently large, we effectively veil the original secret request from the service, maintaining the user’s privacy.</p><p>💡The bucket’s size is intrinsically linked to the hash chunk’s length: a longer string yields a smaller bucket. Through hands-on experimentation, we’ve found that a five-character size currently delivers optimal results. However, this is not set in stone and may be fine-tuned in the future.</p><p>Now, we have a secure service, yet it’s missing a crucial feature. For the service to prove its claim that the secret has been leaked, it must provide the URL location of that leak. Without this feature, the service’s usefulness would be almost null.</p><p>So, <em>how can we share the URL of the leak while maintaining the confidentiality of the remaining URLs in the bucket?</em></p><p>Response: by encrypting this information so only the secret’s owner can retrieve it.</p><h3>4. Adding encryption</h3><p>The idea is simple: each element in the response bucket is now encrypted (using AES-GCM) with the (full-length) hash of the secret as the key. This way, we can guarantee only a user knowing the hash (and therefore the secret) will be able to decrypt the payload and retrieve the URL location.</p><p>This additional layer of encryption significantly reduces the risk of an enumeration attack. Without it, a cybercriminal could potentially attempt every five-character combination, thereby harvesting our entire database of hashed secrets. However, there remains another potential attack scenario that we’ll be addressing shortly.</p><p>We are now faced with a usability issue: the client must painstakingly decipher each item individually to potentially locate the one they possess the key for. There is no way to quickly get an answer to the crucial question: has my secret leaked?</p><p>So, <em>how can we allow the client to get an answer quicker?</em></p><p>Response: by providing an easy-to-check hint for each match.</p><h3>5. Providing a hint</h3><p>The API now provides encrypted responses, coupled with a unique feature — a hint, essentially a hash of the hash. This allows the client to swiftly calculate the hint and determine if a match exists within the response. Put simply, they can rapidly confirm if the hash of their secret is present in the database. To dig deeper, they only need to decrypt the specific item using the original hash of their secret.</p><p>We’ve now built a robust service, which corresponds to the example structure presented at the beginning of this article. Let’s address the attack scenario mentioned before.</p><h3>6. Preventing other risk scenarios</h3><h3>a. An attacker compromises a similar database</h3><p>This scenario implies that an attacker manages to compromise a database of hashed secrets using the same hash function as the one used by our service. In that very special case, they could use our service to reverse the hashes, collect all the locations, and uncover the cleartext secrets.</p><p>To mitigate the above threat, we added a pepper to our hashing function.</p><p>A “pepper” is an additional string added into the hashing process to further increase security. Unlike a “salt”, which is unique for each item, a “pepper” is global.</p><p>Adding a pepper makes our hashing function unique and mitigates the possibility of an attacker reversing our hashes with a dumped database.</p><h3>b. An attacker uses a “rainbow table”</h3><p>What happens if someone attempts to guess the secrets? Similar to passwords, many secrets are not randomly generated but hastily created. This makes them vulnerable to attackers who may use a “rainbow table” — a precomputed table for reversing cryptographic hash functions — to probe our service with a list of common combinations in an attempt to uncover any leaks.</p><p>To mitigate this risk, we’ve implemented two safeguards:</p><ol><li>The service only discloses the first location where a secret is found. This strategy restricts the amount of information that can be misused without hindering legitimate usage.</li><li>Unauthenticated users are limited to five service queries per day. This IP-based rate limit creates a barrier for anyone hoping to strike it lucky with random attempts (we also rate limit authenticated users, but it is less stringent).</li></ol><h3>7. Wrapping up: final design implementation</h3><p>Here is the final interaction diagram to summarize what happens client-side and server-side:</p><p>Two interfaces implement the client-side protocol we described here to interact with the service API:</p><p>This is the end of our journey! To wrap up, here are the key takeaways you need to remember about HasMySecretLeaked:</p><ul><li><strong>At no point does GitGuardian have access to your secret.</strong></li><li>We fully recognize the immense responsibility associated with managing sensitive data, and we take the security challenges seriously.</li><li>Your secret is obfuscated client-side and cannot be reversed by our services.</li><li>Your secret request remains private because you only send the initial five characters of the hash.</li><li>If we find a hit, only you, as the owner of the secret, can decrypt the payload and retrieve the URL location.</li><li>We have ensured that checking if your secret is included in the response is quick and simple without compromising privacy.</li><li>To reduce potential risks, we have added extra security measures to our system, such as making our hashing function more complex and restricting the number of service queries allowed per day.</li></ul><p>We hope you are now ready to take <a href="https://www.gitguardian.com/hasmysecretleaked?ref=blog.gitguardian.com">HasMySecretLeaked</a> for a spin with the peace of mind knowing your secrets are safe!</p><p>Get started with HasMySecretLeaked</p><h3>Prefix size</h3><p>As said earlier, it is important that users share only the prefix of their hashed secret with us, and it is as important for GitGuardian to design the service so that buckets are big enough. This approach ensures that GitGuardian retains minimal, if any, knowledge of the user’s secret.</p><p>The challenge here lies in striking a balance: if the buckets are too small, GitGuardian inadvertently gains excessive insight into the user’s secret. Conversely, overly large buckets can burden the API with hefty payloads. To determine the ideal prefix size, we need to estimate the potential number of secrets in our database.</p><p>Currently, our HMSL database houses approximately 22 million unique secrets. We’ve selected a prefix composed of 5 hexadecimal characters, yielding roughly 1 million buckets and an average of about 22 secrets per bucket. Assuming that the hash distribution is random and follows a normal distribution, we’ve ensured no bucket contains fewer than 8 secrets, which aligns with our protocol.</p><p>It’s important to note that as more secrets are leaked over time, the buckets will gradually fill up. If they become too cumbersome for our API, we can simply extend the prefix length by one, effectively reducing the average bucket size by a factor of 16.</p><h3>Hashing function</h3><p>Our chosen hashing function must adhere to the canonical properties of a hashing function, primarily to deter users from reversing a hash and, consequently, extracting passwords from our database. However, there’s an additional complexity to consider. Passwords don’t follow a random distribution; in fact, they’re quite predictable. Passwords can be systematically enumerated, beginning with the most common ones.</p><p>If an individual knows the prefix of a user’s hash, they could swiftly compute hashes from a standard list of passwords and compare them to the prefix. If they stumble upon a match, they can reasonably conclude that they’ve cracked the user’s password.</p><p>To counter this, we need to select a hashing method that strikes a balance between speed and complexity. It must be quick enough to ensure a smooth user experience yet intricate enough to thwart attackers from rapidly generating a vast list of hashes. This led us to selecting <a href="https://en.wikipedia.org/wiki/Scrypt?ref=blog.gitguardian.com">scrypt</a> as our preferred hashing method.</p><p><em>Originally published at </em><a href="https://blog.gitguardian.com/hasmysecretleaked-building-a-trustless-and-secure-protocol/"><em>https://blog.gitguardian.com</em></a><em> on October 17, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40aec89e568e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gitguardian/hasmysecretleaked-building-a-trustless-and-secure-protocol-40aec89e568e">HasMySecretLeaked — Building a Trustless and Secure Protocol</a> was originally published in <a href="https://medium.com/gitguardian">GitGuardian</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Yes, GitHub’s Copilot can Leak (Real) Secrets]]></title>
            <link>https://medium.com/@thomas.segura/yes-githubs-copilot-can-leak-real-secrets-03a280ad8f9a?source=rss-58fcd5704426------2</link>
            <guid isPermaLink="false">https://medium.com/p/03a280ad8f9a</guid>
            <category><![CDATA[github-copilot]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Thomas Segura]]></dc:creator>
            <pubDate>Thu, 12 Oct 2023 13:01:05 GMT</pubDate>
            <atom:updated>2023-10-20T12:01:57.096Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BkUrfWBdym2sN07y.png" /></figure><p>There has been a growing focus on the ethical and privacy concerns surrounding advanced language models like ChatGPT and OpenAI GPT technology. These concerns have raised important questions about the potential risks of using such models. However, it is not only these general-purpose language models that warrant attention; specialized tools like code completion assistants also come with their own set of concerns.</p><p>Read: <a href="https://blog.gitguardian.com/chatgpt-security-concern/">Why ChatGPT is a security concern for your organization (even if you don’t use it)</a></p><p>A year into its launch, GitHub’s code-generation tool Copilot has been used by a million developers, adopted by more than 20,000 organizations, and generated more than three billion lines of code, GitHub said in a blog .</p><p>However, since its inception, security concerns have been raised by many about the associated legal risks associated with copyright issues, privacy concerns, and, of course, insecure code suggestions, of which examples abound, <a href="https://vlad-rad.medium.com/github-copilot-security-conserns-d4209f0d5c28?ref=blog.gitguardian.com">including dangerous suggestions to hard-code secrets in code.</a></p><p>Extensive security research is currently being conducted to accurately assess the potential risks associated with these newly advertised productivity-enhancing tools.</p><p>This blog post delves into <a href="https://blog.gitguardian.com/yes-github-copilot-can-leak-secrets/Neural%20Code%20Completion%20Tools%20Can%20Memorize%20Hard-coded%20Credentials">recent research</a> by Hong Kong University to test the possibility of abusing GitHub’s Copilot and Amazon’s CodeWhisperer to collect secrets that were exposed during the models’ training.</p><p>As highlighted by <a href="https://www.gitguardian.com/files/the-state-of-secrets-sprawl-report-2023?ref=blog.gitguardian.com">GitGuardian’s 2023 State of Secrets Spraw</a>l, hard-coded secrets are highly pervasive on GitHub, with 10 million new secrets detected in 2022, up 67% from 6 million one year earlier.</p><p>Given that Copilot is trained on GitHub data, it is concerning that coding assistants can potentially be exploited by malicious actors to reveal real secrets in their code suggestions.</p><h3>Extracting Hard-coded Credentials</h3><p>To test this hypothesis, the researchers conducted an experiment to build a prompt-building algorithm trying to extract credentials from the LLMs.</p><p>The conclusion is unambiguous: by constructing 900 prompts from GitHub code snippets, they managed to successfully collect 2,702 hard-coded credentials from Copilot and 129 secrets from CodeWhisper (false positives were filtered out with a special methodology described below).</p><p>Impressively, among those,<strong> at least 200, or 7.4% (respectively 18 and 14%), were real hard-coded secrets they could identify on GitHub</strong>. While the researchers refrained from confirming whether these credentials were still active, it suggests that these models could potentially be exploited as an avenue for attack. This would enable the extraction and likely compromise of leaked credentials with a high degree of predictability.</p><h3>The Design of a Prompt Engineering Machine</h3><p>The idea of the study is to see if an attacker could extract secrets by crafting appropriate prompts. To test the odds, the researchers built a prompt testing machine, dubbed the Hard-coded Credential Revealer (HCR).</p><p>The machine has been designed to maximize the chances of triggering a memorized secret. To do so, it needs to build a strong prompt that will “force” the model to emit the secret. The way to build this prompt is to first look on GitHub for files containing hard-coded secrets using regex patterns. Then, the original hard-coded secret is redacted, and the machine asks the model for code suggestions.</p><p>Of course, the model will need to be requested many times to have a slight chance of extracting valid credentials, because it often outputs “imaginary” credentials.</p><p>They also need to test many prompts before finding an operational credential, allowing them to log into a system.</p><p>In this study, 18 patterns are used to identify code snippets on GitHub, corresponding to 18 different types of secrets (AWS Access Keys, Google OAuth Access Token, GitHub OAuth Access Token, etc.).</p><p>Then, the secrets are removed from the original file, and the code assistant is used to suggest new strings of characters. Those suggestions are then passed through four filters to eliminate a maximum number of false positives</p><p>Secrets are discarded if they:</p><ul><li>don’t match the regex pattern</li><li>don’t show enough entropy (not random enough, ex: AKIAXXXXXXXXXXXXXXXX)</li><li>have a recognizable pattern (ex: AKIA3A3A3A3A3A3A3A3A)</li><li>include common words (ex: AKIAIOSFODNN7EXAMPLE)</li></ul><p>A secret that passes all these tests is considered <em>valid</em>, which means it could realistically be a true secret (hard-coded somewhere else in the training data).</p><h3>Results</h3><p>Among 8,127 suggestions of Copilot, 2,702 valid secrets were successfully extracted. Therefore, the overall valid rate is 2702/8127 = 33.2%, meaning that <strong>Copilot generates 2702/900 = 3.0 valid secrets for one prompt on average.</strong></p><p>CodeWhisperer suggests 736 code snippets in total, among which we identify 129 valid secrets. The valid rate is thus 129/736 = 17.5%.</p><p><strong>So, how can we know if these secrets are genuine operational credentials?</strong> The authors explained that they only tried a subset of the valid credentials (test keys like Stripe Test Keys designed for developers to test their programs) for ethical considerations.</p><p>Instead, the authors are looking for another way to validate the authenticity of the valid credentials collected. They want to assess the memorization, or where the secret appeared on GitHub.</p><p>The rest of the research focuses on the characteristics of the valid secrets. They look for the secret using GitHub Code Search and differentiate <em>strongly</em> memorized secrets, which are identical to the secret removed in the first place, and <em>weakly</em> memorized secrets, which came from one or multiple other repositories. Finally, there are secrets that could not be located on GitHub and which might come from other sources.</p><h3>Consequences</h3><p>The research paper uncovers a significant privacy risk posed by code completion tools like GitHub Copilot and Amazon CodeWhisperer. The findings indicate that these models not only leak the original secrets present in their training data but also suggest other secrets that were encountered elsewhere in their training corpus. This exposes sensitive information and raises serious privacy concerns.</p><p>For instance, even if a hard-coded secret was removed from the git history after being leaked by a developer, an attacker can still extract it using the prompting techniques described in the study. The research demonstrates that these models can suggest valid and operational secrets found in their training data.</p><p>These findings are supported by another recent study conducted by a researcher from Wuhan University, titled <a href="https://arxiv.org/pdf/2310.02059.pdf?ref=blog.gitguardian.com">Security Weaknesses of Copilot Generated Code in GitHub</a>. The study analyzed 435 code snippets generated by Copilot from GitHub projects and used multiple security scanners to identify vulnerabilities.</p><p>According to the study, 35.8% of the Copilot-generated code snippets exhibited security weaknesses, regardless of the programming language used. By classifying the identified security issues using Common Weakness Enumerations (CWEs), the researchers found that “Hard-coded credentials” (CWE-798) were present in 1.15% of the code snippets, accounting for 1.5% of the 600 CWEs identified.</p><h3>Mitigations</h3><p>Addressing the privacy attack on LLMs requires mitigation efforts from both programmers and machine learning engineers.</p><p>To reduce the occurrence of hard-coded credentials, the authors recommend using centralized credential management tools and code scanning to prevent the inclusion of code with hard-coded credentials.</p><p>During the various stages of code completion model development, different approaches can be adopted:</p><ul><li>Before pre-training, hard-coded credentials can be excluded from the training data by cleaning it.</li><li>During training or fine-tuning, algorithmic defenses such as Differential Privacy (DP) can be employed to ensure privacy preservation. DP provides strong guarantees of model privacy.</li><li>During inference, the model output can be post-processed to filter out secrets.</li></ul><h3>Conclusion</h3><p>This study exposes a significant risk associated with code completion tools like GitHub Copilot and Amazon CodeWhisperer. By crafting prompts and analyzing publicly available code on GitHub, the researchers successfully extracted numerous valid hard-coded secrets from these models.</p><p>To mitigate this threat, programmers should use centralized credential management tools and code scanning to prevent the inclusion of hard-coded credentials. Machine learning engineers can implement measures such as excluding these credentials from training data, applying privacy preservation techniques like Differential Privacy, and filtering out secrets in the model output during inference.</p><p>These findings extend beyond Copilot and CodeWhisperer, emphasizing the need for security measures in all neural code completion tools. Developers must take proactive steps to address this issue before releasing their tools.</p><p>In conclusion, addressing the privacy risks and protecting sensitive information associated with large language models and code completion tools requires collaborative efforts between programmers, machine learning engineers, and tool developers. By implementing the recommended mitigations, such as centralized credential management, code scanning, and exclusion of hard-coded credentials from training data, the privacy risks can be effectively mitigated. It is crucial for all stakeholders to work together to ensure the security and privacy of these tools and the data they handle.</p><p><em>Originally published at </em><a href="https://blog.gitguardian.com/yes-github-copilot-can-leak-secrets/"><em>https://blog.gitguardian.com</em></a><em> on October 12, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=03a280ad8f9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microsoft AI involuntarily exposed a secret giving access to 38TB of confidential data for 3 years]]></title>
            <link>https://medium.com/gitguardian/microsoft-ai-involuntarily-exposed-a-secret-giving-access-to-38tb-of-confidential-data-for-3-years-fdc444487ca4?source=rss-58fcd5704426------2</link>
            <guid isPermaLink="false">https://medium.com/p/fdc444487ca4</guid>
            <category><![CDATA[supply-chain]]></category>
            <category><![CDATA[secrets]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Thomas Segura]]></dc:creator>
            <pubDate>Tue, 26 Sep 2023 15:01:54 GMT</pubDate>
            <atom:updated>2023-10-03T08:19:37.564Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*puRDsDSWz8n3HGQg5kP4fA.png" /></figure><p>The WIZ Research team <a href="https://www.wiz.io/blog/38-terabytes-of-private-data-accidentally-exposed-by-microsoft-ai-researchers?ref=blog.gitguardian.com">recently discovered</a> that an overprovisioned SAS token had been lying exposed on GitHub for nearly three years. This token granted access to a massive 38-terabyte trove of private data. This Azure storage contained additional secrets, such as private SSH keys, hidden within the disk backups of two Microsoft employees. This revelation underscores the importance of robust data security measures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/0*LywKH4KRroZCRQCT" /></figure><h3>What happened?</h3><p>WIZ Research recently disclosed a data exposure incident found on Microsoft’s AI GitHub repository on June 23, 2023.</p><p>The researchers managing the GitHub used an Azure Storage sharing feature through a SAS token to give access to a bucket of open-source AI training data.</p><p>This token was misconfigured, giving access to the account’s entire cloud storage rather than the intended bucket.</p><p>This storage comprised 38TB of data, including a disk backup of two employees’ workstations with secrets, private keys, passwords, and more than 30,000 internal Microsoft Teams messages.</p><blockquote><strong><em>SAS (Shared Access Signatures)</em></strong><em> are signed URLs for sharing Azure Storage resources. They are configured with fine-grained controls over how a client can access the data: what resources are exposed (full account, container, or selection of files), with what permissions, and for how long. See </em><a href="https://learn.microsoft.com/en-us/azure/storage/common/storage-sas-overview?ref=blog.gitguardian.com"><em>Azure Storage documentation</em></a><em>.</em></blockquote><p>After disclosing the incident to Microsoft, the SAS token was invalidated. From its first commit to GitHub (July 20, 2020) to its revoking, <strong>nearly three years elapsed</strong>. See the timeline presented by the Wiz Research team:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/0*XGgFz6KhAPC2DAiv" /></figure><p>Why did the token have such an extended lifespan? If you take a look at the timeline, you’ll see that the token’s expiration date was extended by an additional 30 <em>years</em> post-expiration. This longevity isn’t surprising when you consider that the token was intentionally engineered to be shared and grant access to training data.</p><p>Yet, as emphasized by the WIZ Research team, <strong>there was a misconfiguration with the Shared Access Signature (SAS).</strong></p><h3>Data Exposure</h3><p>The token was allowing anyone to access an additional 38TB of data, including sensitive data such as secret keys, personal passwords, and over 30,000 internal Microsoft Teams messages from hundreds of Microsoft employees.</p><p>Here is an excerpt from some of the most sensitive data recovered by the Wiz team:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/0*_N6AKn9zY0l46StU" /></figure><p>Not only was the access scope excessively permissive, but the token was also misconfigured to grant “full control” permissions instead of read-only. This means that an attacker not only had the ability to view all the files in the storage account but could also delete and overwrite existing files.</p><p>As highlighted by the researchers, this could have allowed an attacker to inject malicious code into the storage blob that could then automatically execute with every download by a user (presumably an AI researcher) trusting in Microsoft’s reputation, which could have led to a <strong>supply chain attack</strong>.</p><p><em>Also read </em><a href="https://www.gitguardian.com/learning-center/software-supply-chain-security?ref=blog.gitguardian.com"><em>Examples of software supply chain attacks</em></a></p><h3>Security Risks</h3><p>According to the researchers, Account SAS tokens such as the one presented in their research present a high-security risk. This is because these tokens are highly permissive, long-lived tokens that escape the monitoring perimeter of administrators.</p><p>When a user generates a new token, it is signed by the browser and doesn’t trigger any Azure event. To revoke a token, an administrator needs to rotate the signing account key, therefore revoking all the other tokens at once.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/0*0K3XE5bK7JtfwHA7" /></figure><p>Ironically, the security risk of a Microsoft product feature (Azure SAS tokens) caused an incident for a Microsoft research team, a risk recently referenced by the second version of the Microsoft threat matrix for storage services:</p><h3>Secrets Sprawl</h3><p><a href="https://www.gitguardian.com/files/the-state-of-secrets-sprawl-report-2023?ref=blog.gitguardian.com"><em>Read the State of Secrets Sprawl 2023</em></a></p><p>This example perfectly underscores the pervasive issue of <strong>secrets sprawl</strong> within organizations, even those with advanced security measures. Intriguingly, it highlights how an AI research team, or any data team, can independently create tokens that could potentially jeopardize the organization. These tokens can cleverly sidestep the security safeguards designed to shield the environment.</p><h3>Mitigation strategies</h3><h3>For Azure Storage users:</h3><h4>1 — avoid Account SAS tokens</h4><p>The lack of monitoring makes this feature a security hole in your perimeter. A better way to share data externally is using a Service SAS with a <a href="https://learn.microsoft.com/en-us/rest/api/storageservices/define-stored-access-policy?ref=blog.gitguardian.com">Stored Access Policy</a>. This feature binds a SAS token to a policy, providing the ability to centrally manage token policies.</p><p>Better though, if you don’t need to use this Azure Storage sharing feature, is to simply disable SAS access for each account you own.</p><h4>2 — enable Azure Storage analytics</h4><p>Active SAS tokens usage can be monitored through the <a href="https://learn.microsoft.com/en-us/azure/storage/common/manage-storage-analytics-logs?ref=blog.gitguardian.com">Storage Analytics logs</a> for each of your storage accounts. <a href="https://learn.microsoft.com/en-us/azure/storage/blobs/blob-storage-monitoring-scenarios?ref=blog.gitguardian.com">Azure Metrics</a> allows the monitoring of SAS-authenticated requests and identifies storage accounts that have been accessed through SAS tokens, for up to 93 days.</p><h3>For all:</h3><h4>1 — Audit your GitHub perimeter for sensitive secrets</h4><p>With around 90 million developer accounts, 300 million hosted repositories, and 4 million active organizations, including 90% of Fortune 100 companies, GitHub holds a much larger attack surface than meets the eye.</p><p>Last year, GitGuardian uncovered 10 million leaked secrets on public repositories, up 67% from the previous year.</p><p>GitHub must be actively monitored as part of any organization’s security perimeter. Incidents involving leaked credentials on the platform continue to cause massive breaches for large companies, and this security hole in Microsoft’s protective shell wasn’t without reminding us of the <a href="https://blog.gitguardian.com/toyota-accidently-exposed-a-secret-key-publicly-on-github-for-five-years/">Toyota data breach from a year ago</a>.</p><p>Being able to detect exposed sensitive tokens on GitHub is a unique feature of <a href="https://www.gitguardian.com/monitor-public-github-for-secrets?ref=blog.gitguardian.com">GitGuardian’s Public Monitoring</a> system. It allows security analysts to quickly inspect an organization’s footprint on the platform, identify valid secrets, and assess the severity of incidents. What is more, the engine is able to include developers’ personal public repositories — where 80% of corporate credentials are leaked — to an organization’s perimeter.</p><p>If your company has development teams, it is very likely that some of your company’s secrets (API keys, tokens, password) end up on public GitHub, so you should evaluate your GitHub attack surface by <a href="https://www.gitguardian.com/complimentary-audit-secrets-leaks-public-github?ref=blog.gitguardian.com">requesting a complimentary audit</a>.</p><h3>2 — Lay out traps in the form of honeytokens</h3><p>Do you need time to restructure governance around cloud storage access, yet need to be alerted if highly sensitive parts get scanned by a malicious actor?</p><p>Your best allies are <a href="https://www.gitguardian.com/honeytoken?ref=blog.gitguardian.com">honeytokens</a>. These tokens are decoy AWS secrets you can deploy strategically across your software assets to regain observability in the grey areas of your IT infrastructure. Getting the attackers’ IP addresses, user agent, what actions they were attempting, and the timestamps of each attempt will help you thwart attempts before they can inflict damage on your software supply chain.</p><h3>Final words</h3><p>Every organization, regardless of size, needs to be prepared to tackle a wide range of emerging risks. These risks often stem from insufficient monitoring of extensive software operations within today’s modern enterprises. In this case, an AI research team inadvertently created and exposed a misconfigured cloud storage sharing link, bypassing security guardrails. But how many other departments — support, sales, operations, or marketing — could find themselves in a similar situation? The increasing dependence on software, data, and digital services amplifies cyber risks on a global scale.</p><p>Combatting the spread of confidential information and its associated risks necessitates reevaluating security teams’ oversight and governance capabilities. It also requires the provision of appropriate tools to identify and counteract emerging threat categories. While human errors are an inevitable part of the process, GitGuardian is here to guide you along your security journey.</p><p>Read also:</p><p><a href="https://blog.gitguardian.com/findings-from-the-sophos-2023-active-adversary-report/">Compromised Credentials Leading Cause Of Initial Attack Access And Faster Attacks: Findings from the Sophos 2023 Active Adversary Report</a></p><p><a href="https://blog.gitguardian.com/a-maturity-model-for-secrets-management/">When it Comes to Secrets, How Mature is Your Organization?</a></p><p><em>Originally published at </em><a href="https://blog.gitguardian.com/microsoft-ai-involuntarily-exposed-a-secret-giving-access-to-38tb-of-confidential-data-for-3-years/"><em>https://blog.gitguardian.com</em></a><em> on September 26, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fdc444487ca4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gitguardian/microsoft-ai-involuntarily-exposed-a-secret-giving-access-to-38tb-of-confidential-data-for-3-years-fdc444487ca4">Microsoft AI involuntarily exposed a secret giving access to 38TB of confidential data for 3 years</a> was originally published in <a href="https://medium.com/gitguardian">GitGuardian</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Code to Cloud: Security for Developers [cheat sheet included]]]></title>
            <link>https://medium.com/@thomas.segura/from-code-to-cloud-security-for-developers-cheat-sheet-included-72670e641d84?source=rss-58fcd5704426------2</link>
            <guid isPermaLink="false">https://medium.com/p/72670e641d84</guid>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[code-newbie]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[Thomas Segura]]></dc:creator>
            <pubDate>Mon, 14 Aug 2023 13:00:07 GMT</pubDate>
            <atom:updated>2023-10-16T16:16:44.494Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qmAU4yKrf7DesY_a.png" /></figure><p>From code development and approval to continuous integration and deployment, each stage presents unique challenges and opportunities to enhance the security of your applications.</p><p>Download the cheat sheet:</p><p><a href="https://www.gitguardian.com/files/snyk-gitguardian-cheatsheet">https://www.gitguardian.com/files/snyk-gitguardian-cheatsheet</a></p><p>By following the recommendations in this cheat sheet, you will be able to:</p><ul><li><strong>Identify and fix vulnerabilities</strong> in your code early using the Snyk CLI and Snyk IDE plugins.</li><li><strong>Prevent secrets from being committed</strong> to your repository with GitGuardian’s ggshield.</li><li>Safely <strong>store and share secrets</strong> using encryption or secrets managers.</li><li>Protect your source code from compromise using<a href="https://www.gitguardian.com/honeytoken?ref=blog.gitguardian.com"><strong> honeytokens</strong></a>.</li><li>Conduct <strong>code reviews</strong> and address security weaknesses during the code approval stage.</li><li><strong>Analyze infrastructure code</strong> for misconfigurations using Snyk Infrastructure as CodeI.</li><li><strong>Scan your code and artifacts for vulnerabilities</strong> during the continuous integration and deployment process.</li><li>Ensure that <strong>no secrets are leaked</strong> in the final artifact with GitGuardian integration.</li><li><strong>Be alerted</strong> if your CI/CD service gets compromised using Honeytokens.</li><li><strong>Scan container images</strong> for vulnerabilities and leaked secrets.</li></ul><p>With these security measures in place, you can have confidence in the integrity and security of your code as it moves from development to deployment in the cloud.</p><p>Let’s dive into each stage and explore the tools and practices that will help you build secure and robust applications.</p><h3>Stage 1: Code Development</h3><p>At this stage, you are crafting your code, adding dependencies, preparing your app to interface with external systems (backends, SaaS, databases, etc.), and hopefully writing tests!</p><p>The main threats here are committing a secret, misconfiguration, coding a vulnerability, or adding a malicious dependency. To prevent these outcomes, there is a lot that you can set up to detect and fix issues early on:</p><ul><li><strong>Get security feedback right into your IDE</strong> with the <a href="https://snyk.co/ufRCQ?ref=blog.gitguardian.com">Snyk IDE</a> plugin. This plugin provides real-time security feedback as you code, helping you identify and fix vulnerabilities and issues directly within your development environment.</li><li><strong>Detect and fix vulnerabilities with the Snyk CLI</strong>. Install the <a href="https://snyk.co/ufRCP?ref=blog.gitguardian.com">Snyk CLI</a> globally by running npm install snyk-g. This allows you to run various commands such as snyk test, snyk code test, snyk container test, and snyk iac test to scan your code, dependencies, containers, and infrastructure-as-code for vulnerabilities and misconfiguration. <strong>Never commit a secret again</strong> <strong>with GitGuardian</strong> ggshield. Install GitGuardian by running the following command (on macOS):</li></ul><pre>brew install gitguardian/tap/ggshield</pre><p>Then automatically get a token for scanning with: gghsield auth login<br>To prevent committing secrets, add the ggshield secret scan pre-commit hook to your local .git/hooks folder by using the command: gghsield install --mode local --hook-type pre-commit -a</p><p>You can also scan your local repository immediately to identify hard-coded secrets by running gghsield secret scan repo.</p><h3>Stage 2: Code Approval</h3><p>Whether you are working alongside dozens of fellow coders or contributing to an open-source project, the next step is to push your work to a central repository. This is the occasion for your changes to get reviewed by peers. The goal is to keep code quality consistent, get feedback, and fix security vulnerabilities and license issues.</p><p>To ensure the security of your code during the code approval stage, consider the following guidelines:</p><ul><li><strong>Get feedback</strong>: When working in a team, it’s essential to have at least one pair of eyes review the code for quality, security, and adherence to coding standards. Code reviews can help identify potential security vulnerabilities and provide valuable feedback.</li><li><strong>Check for security failures</strong>: Use <a href="https://snyk.co/ufRCR?ref=blog.gitguardian.com">Snyk Open Source</a> to assess the reliability of the added dependencies. Additionally, it can help identify if a license is compliant with your organization’s policy. This ensures that the dependencies you are using are secure and meet the necessary licensing requirements.</li><li><strong>Check for common security weaknesses</strong>: Leverage <a href="https://snyk.co/ufRCS?ref=blog.gitguardian.com">Snyk Code</a>, a real-time static analysis tool, to identify common security weaknesses in your code. It can provide alerts and recommendations to help you address these weaknesses and improve the overall security of your codebase. <strong>Enforce no secrets get leaked</strong>: Implement a check for leaked secrets in the main repository. This can be done by integrating GitGuardian into your code approval process. By scanning for hard-coded secrets during the code approval stage, you can ensure that no secrets are leaked and avoid the need for a secret rotation procedure.</li><li><strong>Analyze Infrastructure code (IaC) for misconfigurations: </strong>Use <a href="https://snyk.co/ufRCT?ref=blog.gitguardian.com">Snyk Infrastructure as Code</a> (IaC) to analyze your IaC templates and configurations for misconfigurations and vulnerabilities. This helps ensure that your infrastructure is properly configured and secure before deployment.</li></ul><h3>Stage 3: Continuous Integration and Deployment</h3><p>After being approved, your changes finally get merged into the main branch (or the appropriate trunk) of your project. The code is now ready to be built, tested, and eventually deployed. However, before that can happen, multiple checks are needed. Welcome to the automated test kingdom, where the inner workings of the code are scrutinized to ensure quality and security requirements are met.</p><p>During the Continuous Integration and Deployment (CI/CD) pipeline, consider implementing the following steps to ensure the security of your code:</p><ul><li><strong>Scan the source code for vulnerabilities</strong>: Integrate Snyk with your CI/CD pipelines to scan for vulnerabilities during the build process. This ensures that any vulnerabilities in your code are identified and can be addressed before deployment.</li><li><strong>Ensure no secrets are found in the final artifact</strong>: Integrate GitGuardian into your CI/CD pipeline to detect any hard-coded secrets during the pipeline execution. This helps prevent secrets from being included in the final artifact and ensures that sensitive information is not exposed.</li><li><strong>Detect intrusions in your CI/CD pipelines</strong>: Enhance the security of your build process by using Honeytokens. Place Honeytokens in the secure store of your CI/CD provider (as secrets, or environment variables) to ensure that you receive alerts if your builds are compromised. This helps detect any unauthorized access to pipelines and allows you to take appropriate actions. Learn more <a href="https://blog.gitguardian.com/how-to-add-gitguardian-honeytokens-in-ci-cd-pipelines/">here</a>.</li><li><strong>Scan artifacts</strong>: Even if your source code passes all security checks, it’s important to scan the final artifact for vulnerabilities. Use tools like Snyk Container and ggshield secret scan docker to scan container images and ensure that the end product is clean and free from vulnerabilities and leaked secrets.</li></ul><p>By following these steps in the CI/CD pipeline, you can ensure that your code is secure and meets the necessary quality and security requirements before deployment.</p><h3>Stage 4: Deploy</h3><p>Once your code has been approved and tested, it’s time to deploy it to a cloud environment or infrastructure. However, before doing so, it’s important to ensure the security of your deployment process. Here are some steps you can take:</p><ul><li><strong>Secure your deployment pipeline</strong>: Implement secure deployment practices such as using secure connections (HTTPS), verifying the integrity of your deployment artifacts, and using secure authentication methods.</li><li><strong>Scan your deployment configuration</strong>: Use Snyk IaC to scan your infrastructure-as-code (IaC) templates and configurations for misconfigurations and vulnerabilities. This will help you identify any security issues before deploying your code.</li><li><strong>Monitor your deployment</strong>: Implement monitoring and logging solutions to track the performance and security of your deployment. This will help you identify any anomalies or potential security threats. <strong>Implement security best practices</strong>: Follow security best practices for cloud deployments, such as using strong access controls, regularly updating your software and dependencies, and encrypting sensitive data.</li></ul><h3>Stage 5: Cloud</h3><p>Once your code is deployed to a cloud environment, it’s important to continuously monitor the security of your cloud infrastructure and applications. Here are some steps you can take to ensure the security of your cloud environment:</p><ul><li><strong>Implement logging and monitoring</strong>: Set up logging and monitoring solutions to track and analyze the activity in your cloud environment. This will help you detect any security vulnerabilities or threats.</li><li><strong>Implement threat detection</strong>: Use threat detection tools and services to identify and respond to potential security threats in real-time. This can include detecting unauthorized access attempts, unusual network traffic, or suspicious behavior.</li><li><strong>Regularly update and patch</strong>: Keep your cloud infrastructure and applications up to date by regularly applying security patches and updates. This will help protect against known vulnerabilities and exploits.</li><li><strong>Implement access controls</strong>: Use strong access controls and authentication mechanisms to ensure that only authorized users and services can access your cloud resources. This can include implementing multi-factor authentication, role-based access controls, and least privilege principles. Get the <a href="https://blog.gitguardian.com/understanding-identity-and-access-management-best-practices-cheat-sheet-included/">IAM cheat sheet here</a>.</li><li><strong>Regularly review and audit</strong>: Conduct regular security reviews and audits of your cloud environment to identify any potential security weaknesses or misconfigurations. This can help you proactively address any security issues before they are exploited.</li></ul><p>By following these steps and utilizing tools like Snyk and GitGuardian, developers can ensure the security of their code throughout the entire development and deployment process.</p><p><em>Originally published at </em><a href="https://blog.gitguardian.com/from-code-to-cloud-security-for-developers-snyk/"><em>https://blog.gitguardian.com</em></a><em> on August 14, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72670e641d84" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>