<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alexandre Viau</title>
    <description>The latest articles on DEV Community by Alexandre Viau (@aviau).</description>
    <link>https://dev.to/aviau</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F894588%2F66481a29-1512-4b80-a9f0-fa7a51a07e61.jpeg</url>
      <title>DEV Community: Alexandre Viau</title>
      <link>https://dev.to/aviau</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aviau"/>
    <language>en</language>
    <item>
      <title>Incorporating LLMs Into Cybersecurity</title>
      <dc:creator>Alexandre Viau</dc:creator>
      <pubDate>Thu, 21 Sep 2023 15:21:48 +0000</pubDate>
      <link>https://dev.to/flare/incorporating-llms-into-cybersecurity-1eh1</link>
      <guid>https://dev.to/flare/incorporating-llms-into-cybersecurity-1eh1</guid>
      <description>&lt;p&gt;Bombarded with multiple alerts coming from multiple disconnected services, security analysts continue to struggle with alert fatigue. While they need context about threats facing their organizations, many also find identifying the right context challenging. &lt;/p&gt;

&lt;p&gt;Today, companies expect security analysts to be experts in everything from the technical to the criminal underground. In reality, this just isn’t possible. However, large language models (LLMs) excel at summarizing large quantities of data, offering security teams a starting point for their analyses.&lt;/p&gt;

&lt;p&gt;Flare uses LLMs to help analysts get the insights and answers they need quickly so that they can filter out false positives and focus on what really matters. &lt;/p&gt;

&lt;h1&gt;
  
  
  Using LLMs to Provide Context
&lt;/h1&gt;

&lt;p&gt;LLMs can help separate out important context. Typically we see two different use cases: non-technical and technical. &lt;/p&gt;

&lt;h2&gt;
  
  
  Non-Technical Context from LLMs
&lt;/h2&gt;

&lt;p&gt;From a non-technical point of view, LLMs adapt well to given slang language. They understand the context and quickly summarize information, eliminating the need to do Google searches. &lt;/p&gt;

&lt;p&gt;First, criminal underground chatter uses slang that has a different meaning within their community when compared to the technical community. &lt;/p&gt;

&lt;p&gt;For example, they often use the term “logs,” referring to stolen usernames and passwords. Technical professionals usually recognize this term as the digital record of activity happening in their environment. With the prompt, LLMs can “translate” this for you. &lt;/p&gt;

&lt;p&gt;Second, LLMs can help you understand what an application does. For example, when threat actors post stolen credentials for sale, they usually name the application. By explaining the application, LLM tools make it easier to determine whether the stolen credentials pose a risk to your organization’s security posture. &lt;/p&gt;

&lt;h2&gt;
  
  
  Technical Context from LLMs
&lt;/h2&gt;

&lt;p&gt;At a technical level, ChatGPT does an excellent job of helping analysts better identify real, exploitable risks to their environments. &lt;/p&gt;

&lt;p&gt;For example, when Flare identifies a GitHub match, the LLM can look at the code and understand whether the mention indicates a risk or not. When developers use a base template for an app rather than starting from scratch, they often make a copy and rename it for their company before they start working. Sometimes, these files may have a hardcoded password. However, this public facing hardcoded password poses little risk to the company until the developer starts modifying the code to build the company-specific application. &lt;/p&gt;

&lt;p&gt;When Flare detects the company name in GitHub, the LLM provides context around whether the match poses little risk because it was in a default config file or could indicate a problem because the developer made a modification. &lt;/p&gt;

&lt;h1&gt;
  
  
  Limitations of LLMs
&lt;/h1&gt;

&lt;p&gt;While LLMs provide various benefits, they also come with some limitations. LLMs analyze unstructured data which poses difficulties when writing prompts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Unstructured Data
&lt;/h2&gt;

&lt;p&gt;When inputting a query, the LLM has a hard time deciphering the difference between the question being asked and the data being supplied. For example, if you’re providing the text of a message and asking if it was written by a specific threat group, the LLM gets confused. It can often focus on the threat group’s name or a username in the prompt rather than analyzing the message’s text that you want to know about. &lt;/p&gt;

&lt;h2&gt;
  
  
  Input Size
&lt;/h2&gt;

&lt;p&gt;LLMs can limit the amount of data that it can summarize so choosing what information the prompt includes is critical.&lt;/p&gt;

&lt;p&gt;Although ChatGPT’s context window simulates a conversation to look human, the LLM doesn’t “remember” the beginning of conversations. If you engage in a long conversation, then it won’t be able to answer appropriately because it may not be accessing the original information, such as the threat actor's name. &lt;/p&gt;

&lt;p&gt;To get the most accurate actor profile possible, you need to choose the inputs carefully. Ideally, when an actor is active on the criminal underground and the clear web, you want to take a little bit of both. You need to combine some of the:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Oldest criminal underground activity&lt;/li&gt;
&lt;li&gt;Recent criminal underground activity &lt;/li&gt;
&lt;li&gt;Oldest clear web activity&lt;/li&gt;
&lt;li&gt;Recent clear web activity &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With the right inputs, the model can fill the gaps, giving you a good high level view of what the threat actor does. &lt;/p&gt;

&lt;h2&gt;
  
  
  Source Code
&lt;/h2&gt;

&lt;p&gt;LLM models use tokenization that transforms texts into numbers which often means that ChatGPT can analyze less code in a given input than it can text. Consider the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CHAT GPT&lt;/li&gt;
&lt;li&gt;chat GPT&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While the human eye and mind reads these as the same two phrases, the LLM model transforms following data point into a separate number:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;chat&lt;/li&gt;
&lt;li&gt;CHAT&lt;/li&gt;
&lt;li&gt;G&lt;/li&gt;
&lt;li&gt;P&lt;/li&gt;
&lt;li&gt;T&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What people think is two pieces of data, the LLM model views it as five. &lt;/p&gt;

&lt;p&gt;When communicating code with ChatGPT, you have a smaller token budget than you do with text, meaning that you have to be more careful when inputting queries so that you don’t waste energy computing information that doesn’t matter. &lt;/p&gt;

&lt;p&gt;In this case, you want to look for the interesting parts of the source code and only send those. Some examples might be inputting:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The metadata for the part of a file where your company’s name is mentioned&lt;/li&gt;
&lt;li&gt;Specific project name, location, and developer&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Lessons Learned: Engineering Prompts
&lt;/h1&gt;

&lt;p&gt;When dealing with token budgets, engineering prompts become incredibly important. Unfortunately, no clear answer around best technique exists. The process requires you to test and iterate the prompt. Some prompt improvements more than doubled the output’s value. &lt;/p&gt;

&lt;p&gt;LLMs can assume that all information provided at input is true or factual. For example, a prompt might ask a question about whether your company’s data was part of a specific data breach. The LLM will assume that the corporate data was part of the breach rather than researching the breach to look for the corporate data.&lt;/p&gt;

&lt;h1&gt;
  
  
  Future of LLMs in Cybersecurity
&lt;/h1&gt;

&lt;p&gt;A fundamental problem in cybersecurity is the communication gap across different people in the company. LLMs are powerful for communication between different audiences, especially when looking at how teams can use them for reporting. LLMs empower less experience security team members by helping them understand context so that they know how to efficiently escalate alerts. Additionally, CISOs and others interacting with business leadership can use LLMs to explain technical bugs or data breach information in a way that addresses that audience’s needs. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Connect services across Kubernetes clusters using Teleproxy</title>
      <dc:creator>Alexandre Viau</dc:creator>
      <pubDate>Thu, 21 Jul 2022 20:36:00 +0000</pubDate>
      <link>https://dev.to/flare/connect-services-across-kubernetes-clusters-using-teleproxy-jla</link>
      <guid>https://dev.to/flare/connect-services-across-kubernetes-clusters-using-teleproxy-jla</guid>
      <description>&lt;p&gt;&lt;a href="https://github.com/flared/teleproxy" rel="noopener noreferrer"&gt;Teleproxy&lt;/a&gt; is a shell script that lets you quickly replace a Kubernetes deployment by a single pod that forwards incoming traffic to another pod running in a destination Kubernetes cluster.&lt;/p&gt;

&lt;p&gt;The tool is based on &lt;a href="https://github.com/telepresenceio/telepresence" rel="noopener noreferrer"&gt;telepresence&lt;/a&gt;. It is used at Flare Systems to keep our development setup light and still be able to quickly connect our test apps to a more realistic “staging” environment.&lt;/p&gt;

&lt;p&gt;See the code at &lt;a href="https://github.com/flared/teleproxy" rel="noopener noreferrer"&gt;https://github.com/flared/teleproxy&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ideal for minimal Minikube setups&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Most of Flare Systems’ development setup is based around Minikube, a tool that lets you run Kubernetes locally as a single-node cluster.&lt;/p&gt;

&lt;p&gt;While Minikube is great, we quickly ran into performance issues. Devs don’t necessarily have the resources to run all the services they need to test the software component they are working on, or maybe they’d rather have more than 30 minutes of battery life! They may also want to interface with a database that contains more data than the one that we ship in the local development environment.&lt;/p&gt;

&lt;p&gt;It would be great if there was a tool that allowed you to quickly swap the database that runs locally inside Minikube with a proxy that points to a database running in another cluster. This would allow for all services running in Minikube to instantly connect with another database with little to no configuration changes. This is exactly what teleproxy allows you to do.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using teleproxy to swap a kubernetes deployment with a proxy&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Say you have local deployment called &lt;code&gt;someservice&lt;/code&gt; with pods listening to port &lt;code&gt;8080&lt;/code&gt; running in your local cluster and you want to replace it with a proxy to another deployment running in a destination cluster, you would run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tele-proxy &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--source_context&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;minikube &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--source_deployment&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;someservice &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--source_port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;8080 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--target_context&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;staging &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--target_pod&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;someservice-77697866c6-vsk59 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--target_port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;How it works&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Teleproxy is based on telepresence. All it does is it runs &lt;code&gt;kubectl port-forward&lt;/code&gt; in telepresence’s replacement pod. If you don’t already know how telepresence works, the following deployment diagram should help. It follows traffic from a client pod, which uses the service that we are replacing, to the target pod, which is an equivalent pod running inside another cluster.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flukt4ld2adzw62mlrzeu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flukt4ld2adzw62mlrzeu.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The traffic originates from the client, it probably targets &lt;code&gt;someservice&lt;/code&gt; using the deployment's Kubernetes service.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The traffic is received by telepresence’s incluster container. Telepresence has scaled down the &lt;code&gt;someservice&lt;/code&gt; deployment and has replaced the pods by this single incluster proxy. It forwards any incoming traffic to the telepresence local pod which is running outside of the cluster.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The traffic is received by telepresence’s local container, which forwards it to the teleproxy container.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The traffic is received by teleproxy and is forwarded to the destination pod in Cluster B trough &lt;code&gt;kubectl port-forward&lt;/code&gt;. This container is able to run a port-forward to your destination cluster because it mounts your local kubectl config, some specific environment variable and contains common tools for authenticating against a kubernetes cluster such as the AWS and Google Cloud CLIs.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Debugging Teleproxy&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you start from a working telepresence setup, the only complexity that is added by teleproxy is that the teleproxy container must be able to connect to your target cluster. Depending on how you regularly connect to that cluster, you may need to mount configuration files or add environment variables to the teleproxy container.&lt;/p&gt;

&lt;p&gt;We have configured teleproxy for our own use and have gotten it working with both GKE and AWS EKS, this required:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;mounting &lt;code&gt;~/.aws&lt;/code&gt; , &lt;code&gt;~/.kube&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Installing the AWS CLI and Google Cloud CLI&lt;/li&gt;
&lt;li&gt;Setting up compat symlinks for OSX users.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There is probably more to do, and we are willing to merge anything that makes sense.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Appendix&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Telepresence: &lt;a href="https://www.telepresence.io/discussion/overview" rel="noopener noreferrer"&gt;https://www.telepresence.io/discussion/overview&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Open Source @ Flare Systems: &lt;a href="https://flared.github.io/" rel="noopener noreferrer"&gt;https://flared.github.io/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Teleproxy: &lt;a href="https://github.com/Flared/teleproxy" rel="noopener noreferrer"&gt;https://github.com/Flared/teleproxy&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>kubernetes</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
