<?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 Jerry Gagelman on Medium]]></title>
        <description><![CDATA[Stories by Jerry Gagelman on Medium]]></description>
        <link>https://medium.com/@drjerry?source=rss-de985bec1eab------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*hL4aoOS6x7rqQn3xr56LoQ.jpeg</url>
            <title>Stories by Jerry Gagelman on Medium</title>
            <link>https://medium.com/@drjerry?source=rss-de985bec1eab------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 14:58:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@drjerry/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[Cybersecurity and Machine Learning: Exploit Prediction]]></title>
            <link>https://medium.com/@drjerry/cybersecurity-and-machine-learning-exploit-prediction-d0f5f829cbed?source=rss-de985bec1eab------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0f5f829cbed</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[security-vulnerabilities]]></category>
            <dc:creator><![CDATA[Jerry Gagelman]]></dc:creator>
            <pubDate>Mon, 29 Jan 2018 15:27:30 GMT</pubDate>
            <atom:updated>2020-11-15T02:08:37.788Z</atom:updated>
            <content:encoded><![CDATA[<p>This post introduces some of what I’ve been working on around the intersection of cybersecurity and machine learning. Many different things may leap to mind when one hears those two terms in the same sentence: intrusion detection, malware classification, and so on. Just to set the stage, this post is not about any of those things, but rather <em>preventative measures</em> in cybersecurity.</p><p>When I began writing this post I wanted to devote a couple paragraphs to providing context and to motivate why ML is a reasonable tool for the job. There were so many things to unpack that that introduction evolved into its own article on <a href="https://medium.com/@drjerry/cybersecurity-and-machine-learning-risk-measures-c44fd39be3b9">risk measures</a>. You may want to refer to that for background on the pain points of vulnerability remediation. If you really just care more about machine learning and domain specific applications, read on.</p><p>All of the tools needed to reproduce the work done here are in a GitHub <a href="https://github.com/drjerry/cve-score">repository</a>.</p><p>None of these ideas are ground breaking or novel, and I want to first give credit where it is due. A while back I heard a <a href="https://www.slideshare.net/MichaelRoytman/rsa-2017-predicting-exploitability-with-predictions">talk by Michael Roytman</a> from Kenna Security that really helped to validate and refine a lot of my thinking on this subject. More recently, researchers from the MIT Lincoln Lab <a href="https://arxiv.org/abs/1707.08015">released a paper</a> on this exact subject. My approach sticks pretty close to that paper, and I will refer to it as (Bullough 2017) when needed.</p><h3>Background</h3><p>There are two subtly different problems that are easily confounded: <em>vulnerability scoring</em> versus <em>exploit prediction</em>. (More details about vulnerabilities and exploits are in <a href="https://medium.com/@drjerry/cybersecurity-and-machine-learning-risk-measures-c44fd39be3b9">risk measures</a>.) A reliable, automated solution to the vulnerability scoring problem is what IT and Security administrators really need to be more productive. This is a hard problem. The exploit prediction problem is more straightforward to solve as an application of machine learning. A good solution to the latter is used as a proxy for a solution to the former. There is sound reasoning behind this approach, particularly when the vulnerability score should be based on risk.</p><p>The first real stab at the exploit prediction problem using machine learning was reported at the <a href="https://research.google.com/pubs/pub36738.html">KDD 2010</a> conference. (PDF available from the link.) During the intervening years, new research has emerged, but only at a trickle. <a href="https://medium.com/(https://arxiv.org/abs/1707.08015">(Bullough 2017)</a> has a good bibliography. I would venture that, when viewed as an application of machine learning, a lot of low hanging fruit remains.</p><h3>What makes this problem challenging?</h3><p>One difference between 2010 and now is the widespread availability of good data on software vulnerabilities. The data is basically clean when it comes out of the pipe. More precisely, the data is so well structured that any needed filtering or transformation steps are straightforward to apply.</p><p>Exploit prediction is an example of a <em>supervised learning</em> problem. The vulnerability data covers the space of <em>features</em> that can be used to train a machine learning model. However, supervised learning requires corresponding <em>labels</em> for the data. How to acquire and assign labels to vulnerability data is not completely straightforward.</p><p>I call this the <strong>label engineering</strong> problem.</p><p>To recall some established terminology: each data record needs to be expressible as a pair <em>(X, y)</em>, where <em>X</em> is a vector of attributes, and <em>y</em> encodes the “label.” For uniformity we only allow <em>y</em> values to be 0 or 1. In the context of exploit prediction, the encoding <em>y = 1</em> means that the vulnerability described by <em>X</em> has an exploit, and <em>y = 0</em> means that <em>X</em> does not have an exploit.</p><p>As good as the vulnerability data is, it almost never includes useful information about related exploits, even though there are well maintained public repositories of the latter. Joining these data sources together requires some human expertise. The <a href="https://github.com/drjerry/cve-score">research tools</a> have a “curation” folder that includes scripts for acquiring the features (the <em>X’s</em>) and different classes of labels (the <em>y’s</em>) and stitching them together.</p><p>Understanding the next difficulty of the exploit prediction problem relates to how machine learning models are evaluated. Suppose that one has finished the data collection, label engineering, and now has a good set of <em>(X, y)</em> pairs. The next step is to split this data into two sets: the <em>training examples</em> and the <em>testing examples</em>. The main point is that a learning algorithm produces a statistical artifact; the learned parameters of a model are statistical estimates. Evaluating the quality of that model, again, requires another statistical procedure on a random sample of data.</p><p>The difficulty this presents with vulnerability data is what I call the <strong>intrinsic temporality</strong> problem. Vulnerability disclosures and exploit publications accrete over time. Employing a random train/test split that does not respect temporality can allow the model to “leak” information from the future into the past, exaggerating its performance. <a href="https://arxiv.org/abs/1707.08015">(Bullough 2017)</a> explore this systematically, drawing sobering conclusions about previously reported results.</p><p>The final difficulty in exploit prediction is the <strong>class imbalance</strong> problem. Again suppose that one has collected a good set of <em>(X, y)</em> data points. The expected ratio of positive to negative observations — that is, <em>y = 1</em> versus <em>y = 0</em> — is on the order of 1-to-40. (See the table in <a href="https://medium.com/@drjerry/cybersecurity-and-machine-learning-risk-measures-c44fd39be3b9">risk measures</a> with data for Exploit DB.) This ratio persists across many time scales, whether looking at all data from 1999–2018, or just data from a two year range.</p><p>To draw this into relief, suppose that 98% percent of the examples in your test set are negative cases (“not exploitable”), and the other 2% are positive cases. One model that, trivially, is 98% accurate is to always declare “negative,” regardless of the input features. Of course the model will have a 100% false negative rate, but it is still 98% accurate. In scenarios with high class imbalance, the accuracy metric tends to provide little information, and the <a href="https://en.wikipedia.org/wiki/Precision_and_recall">precision and recall metrics</a> are more useful to monitor.</p><h3>Experiment: how good is CVSS at exploit prediction?</h3><p>The CVSS score is mechanism for ranking the severity of software vulnerabilities. Despite its well documented shortcomings, it remains the industrywide accepted method for this task. A common argument against the utility of the CVSS score is that it just a <em>manually tuned formula</em> that takes as input a vector of categorical (e.g., high/medium/low) attributes.</p><p>The experiment proposed here is not to reinvent the CVSS score; rather, to train a machine learning model for exploit prediction using only the CVSS attributes as features.</p><p>To emphasize, the authors of the CVSS score would not necessarily claim that CVSS is a good predictor of exploit likelihood. The problem they address has more to do with vulnerability scoring. Their solution is a consensus-based model of severity that relies on attributes that are cheap to measure and mostly free from subjectivity.</p><p>The GitHub <a href="https://github.com/drjerry/cve-score/wiki">repository wiki</a> included details on reproducing these experiments. Here only the results are reported. At a very high level:</p><ol><li>Features generated from <a href="https://nvd.nist.gov/vuln/data-feeds">NVD JSON sources</a>. Only the cvssV2 objects were used, with a bag-of-word encoding on JSON paths. The feature space is 18-dimensional.</li><li>Labels generated using Exploit DB. CVEs with an associated exploit constitute positive examples.</li><li>The train/test split determined by year-of-issue for CVEs: the training examples included only CVEs between 2011–2015, and testing only CVEs between 2016–2017. These sample sizes are about 29k and 18k respectively.</li><li>Linear classifier (i.e., 1-layer network with softmax outputs) trained using TensorFlow. No regularization or hyper-parameter tuning carried out, except probing different learning rates to gauge convergence.</li></ol><p>It turns out that using CVSS attributes as a linear predictor for exploit likelihood is <strong>not a good model.</strong> There multiple metrics for quantifying this. One qualitative visualization is to inspect the distribution of predicted probabilities (i.e., classifier “scores”) across the different ground truth labels:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*p8q38vvmu-dySQ3uupcAUg@2x.png" /><figcaption>Baseline model score distributions</figcaption></figure><p>The red bins constitute the true positive labels from the test set — which visually aids in understanding the class imbalance. The <em>x</em>-axis is exploit likelihood, i.e., <em>P</em>(Exploit|Vulnerability) for this particular model.</p><p>A clearer separation between the red bins and blue bins — necessarily, blue clustered on the left and red clustered on the right — would indicate that the model found a clearer decision boundary. The strong mixture and positive and negative observations through the range of scores visually represents the low precision metric of this model.</p><p>Incidentally, the reported <em>accuracy metric </em>for this model is 96%. Its false-negative rate is 100%.</p><h3>Experiment: is there a better signal?</h3><p>The <a href="https://github.com/drjerry/cve-score">tools released</a> allow for rapid experimentation. The following adjustments were made to previous set-up:</p><ul><li>Features included CVSS attributes <em>and</em> the tokenized description field from the NVD sources. After normalizing the text, the vocabulary of the training corpus (i.e., CVEs 2011-2015) had almost 59k tokens. This was filtered to include only tokens occurring at least 25 times across the training corpus, reducing it to 2243 dimensions. Bag-of-words encoding was used for both the CVSS and text tokens, <em>yielding a 2261-dimensional feature space.</em></li><li>A weighted loss function was used to counter class imbalance: positive examples were re-weighted with a value inversely proportional to the positive class rate.</li></ul><p>All other factors — label engineering and train/test split — were held the same. The resulting linear model has a much different quality than the CVSS-only model. Although there is still no clear decision boundary between positive and negative test cases, the predicted probabilities follow a <a href="https://en.wikipedia.org/wiki/Beta_distribution">beta-like distribution</a> that one would expect, with support on almost the whole unit interval.</p><p>Because the tools allow for rapid experimentation, why stop with a (linear) softmax classifier? Using same feature engineering steps and weighted loss function described in the previous bullet points, and the same label engineering and train/test split as the baseline model, a neural network with the following configuration was trained:</p><ul><li>Two hidden layers with 128 and 32 units respectively, and rectified-linear activation functions.</li><li>Dropout regularization on the final layer. Learning rate halved on a schedule every 50 epochs.</li></ul><p>A couple configurations were explored by doubling the number of units in each layer. No other hyper-parameter tuning was carried out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*CfpSGWuV4nKAeYK_qIkYZg@2x.png" /><figcaption>Enhanced model scores distributions</figcaption></figure><p>Even though the neural net model lacks a good decision boundary, it is qualitatively better than the pure linear model, with the same feature space, in the sense that the cluster of scores for the positive (red) labels is shifted to the right by a mean value of about 0.15.</p><h3>Conclusions</h3><p>Although we like to think of the NVD records as containing “all we need to know” about the associated software vulnerabilities, experiments indicate that its signal indicating empirical exploitability is a weak one. Nevertheless these experiments show that headway can be made: starting from the baseline model, and tweaking it with the next-most-obvious-thing™ in an iterative fashion, can yield insight after a couple steps. Incidentally <a href="https://arxiv.org/abs/1707.08015">(Bullough 2017)</a> report even better qualitative results than this, using a more expansive feature set, and using an SVM classifier instead.</p><p>The cybersecurity community is following the steady trend toward bringing machine learning and artificial intelligence to bear on their domain specific problems. As always, one of the largest gaps is the shortage of talent with machine learning expertise. One of my hopes for chipping away at this gap is to expose the community of machine learning experts to some of the cybersecurity fundamentals — clear statements of interesting problems, the availability of reliable datasets, and maybe even some tools to get started.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0f5f829cbed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cybersecurity and Machine Learning: Risk Measures]]></title>
            <link>https://medium.com/@drjerry/cybersecurity-and-machine-learning-risk-measures-c44fd39be3b9?source=rss-de985bec1eab------2</link>
            <guid isPermaLink="false">https://medium.com/p/c44fd39be3b9</guid>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Jerry Gagelman]]></dc:creator>
            <pubDate>Tue, 23 Jan 2018 00:12:17 GMT</pubDate>
            <atom:updated>2018-01-23T00:12:17.684Z</atom:updated>
            <content:encoded><![CDATA[<p>Several different things may leap to mind when one hears the terms “cybersecurity” and “machine learning” in the same sentence: intrusion detection, malware classification, and so on. Just to set the stage, this post is not about any of those thing, but rather <em>preventative measures.</em></p><p>Discussions of cybersecurity are often loaded with complexity and technical jargon. This post aims to simplify the problem setting and unwind some of the jargon. Discussions about machine learning are also loaded with complexity and jargon; that part will be saved for a later post.</p><h3>Vulnerabilities and exploits</h3><p>A network intrusion is a scenario where an attacker gains remote access to a <strong>host</strong> on a network in a way that allows them to run system commands, extract files, access other hosts, or simply interfere with the system or services running. A “host” on a network is often a server, but could be a desktop station, a router, a video camera, or any imaginable device that can be connected to a network. Remote access is the important part: think of it as an interactive shell in which an adversary can carry out attacks; like an SSH shell, but not necessarily using the SSH protocol.</p><p>From the perspective of building a defensive security system, there are a few main ways that that an intrusion can happen:</p><ol><li>Someone within an organization hands out credentials — usually unknowingly, such as in a phishing attack.</li><li>A misconfiguration, where the software is running correctly, but is accidentally set up to allow unintended access from a remote host. Good examples of this are default passwords on internet connected devices that are never changed.</li><li>A software vulnerability is exploited.</li></ol><p>Estimates vary as to which type of these three vectors of attack is the most prominent or leads to the most damage. Experts agree that the first one presents the largest attack surface, circumscribed only by the limits of human error, gullibility, or malicious intent.</p><p>The focus here is the third item: vulnerabilities and their exploits. Simply put, a <strong>vulnerability</strong> is a flaw or bug in a piece of software that causes it to behave in a way that is unintended or unknown to the software’s authors. An <strong>exploit</strong> is a small piece of software or specially crafted input that leverages the vulnerability and triggers the unintended behavior. <em>Not all vulnerabilities are created equal in terms of the degree of danger they present, and not all vulnerabilities are effectively exploitable in the same fashion.</em> More details will follow shortly.</p><p>Focusing on vulnerabilities is a operationally tractable problem for two specific reasons. First, all vulnerabilities are essentially public. On a daily basis, new vulnerabilities are discovered and reported by software vendors or independent security researchers. The public disclosure of a vulnerability is typically coordinated with the near immediate release of a software patch or update that remediates the vulnerability. All public disclosures are aggregated in the <a href="https://nvd.nist.gov/">National Vulnerability Database</a>, which is updated daily. Secondly, there are many different <a href="http://sectools.org/tag/vuln-scanners/">open and commercial scanners</a> that help IT teams identify and categorize the active vulnerabilities on all devices in a network range.</p><h3>Prioritizing Remediation</h3><p>A good scanner can determine where and what the problems are, and software patches — or other <em>remediations — </em>will make the problems go away. A healthy cycle of scan-and-remediate removes one of the three main vectors of network intrusions. Problem solved, right?</p><p>The problem with this reasoning is that, while a healthy cycle of scanning is straightforward to achieve, remediation often entails complexity on another order of magnitude. For instance, patches that impact the JVM, low-level system libraries, or the operating system often require a maintenance window for the entire stack of software running on those systems. For a organization’s mission critical services, this is something not undertaken lightly.</p><p>Another limiting factor to a simple scan-and-remediate cycle is the volume of data involved. For a small network range of, say, a thousand hosts or “assets,” a scanner may report a volume of vulnerabilities on the order of ten thousand. (Many of these are benign, or may be the same vulnerability repeated across different hosts.) Each of the categorized vulnerabilities needs to manually reviewed by a member of the IT team, and any remediation steps need to be addressed or scheduled. For a small IT team with many responsibilities in addition to patch maintenance, this is patently infeasible.</p><p>There is a way to prioritize allocation of resources in remediating vulnerabilities. As mentioned earlier, not all vulnerabilities are created equal, and not all are effectively exploitable. The standard Information Security risk model categorizes risk by the degree that it impacts <a href="https://en.wikipedia.org/wiki/Information_security#Key_concepts">confidentiality, integrity, and availability (CIA)</a> of the underlying resource or data. For software vulnerabilities, the industry has largely adopted a deterministic scoring system, called the <a href="https://www.first.org/cvss/">Common Vulnerability Scoring System (CVSS)</a>, that assigns a nominal risk score on the 0–10 scale to each vulnerability. It bears repeating that this is a <em>deterministic formula</em> reached by consensus of industry experts.</p><h3>Other measures of risk</h3><p>One of the seldom cited drawbacks of the CVSS score is that its formula only includes a few theoretical “exploitability metrics” with low/medium/high attributes, <em>but does not take into consideration the empirical likelihood of an existing exploit. </em>This last point is arguably the most important for establishing a realistic risk score.</p><p>When a security vulnerability is reported, its verification typically includes a proof of concept exploit. Not all of these are necessarily robust or reliable enough to be used “in the wild” to carry out a remote attack. A smaller subset of these which are reliable enough to be included in penetration testing tools will make their way from research channels into public repositories of exploits. <a href="https://www.exploit-db.com/">Exploit-DB</a> and <a href="https://www.rapid7.com/db/">Rapid7</a> are among the most active repositories.</p><p>It would be remiss to leave <strong>zero-day exploits</strong> unmentioned. These are exploits targeting a vulnerability that is not yet known to the vendor, or where a patch is not yet available. The reality is that zero-days constitute a much larger mindshare of the discussion around cybersecurity than their share of active exploits. The reasons are essentially economic — zero-days are prohibitively resource intensive to develop and have no guaranteed lifespan — making them a scarcity. From the perspective of an adversary, deploying a reliable public exploit is much more viable, especially if accomplished at a scale leveraging of the fact that some portion of the systems hit will be unpatched. Most malware campaigns that deploy “exploit kits” rely on mass drive-by delivery tactics.</p><p>To put all of these indicators of risk into perspective, let’s look at some numbers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*MKkj50aZs4kXdvruUdiLHw@2x.png" /></figure><p>This reflects a snapshot of data from January 2018. The NVD database contains about 94k vulnerabilities that have a CVSS V2 score. Of those, almost 40 percent have a nominal risk evaluation that is either “High” or “Critical.” But when restricting to vulnerabilities that have publicly available exploit, the rate drops to around 2 percent.</p><p>The takeaway from second and third lines of the table reflect a common issue familiar to anyone responsible for operationalizing an IT security program: thresholds that are manually tuned, regardless of the underpinning expertise, still yield a volume of data exceeding what can be manually processed. (Think of the scenario where a scan yields ten thousand results, but <em>only 1,400 are critical and need to be addressed immediately.</em>)</p><p>The last line of table captures only a <em>stochastic</em> relationship — whether or not a vulnerability met the criterion to earn it a public exploit — but points toward a more principled approach of risk prioritization:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/264/1*p95UmJ6Sb4nnj2GWHuGYaQ@2x.png" /></figure><p>The right hand sided expresses the <em>conditional probability</em> that a vulnerability has an exploit. It is a number between 0 and 1, where <em>P</em>(Exploit|<em>V</em>) = 1 reflects absolute certainty that the condition is true, and <em>P</em>(Exploit|<em>V</em>) = 0 certainty that it is false.</p><p>Because this score is based on probability, decisions can be based on <em>confidence intervals</em> instead of manual thresholds. For instance, vulnerabilities with score at least 0.95 constitute the subset where the model is 95% confident that they have (or will have) a public exploit. Such a model would given an IT team finer grain control over how it prioritizes work, and one that better highlights what an adversary would regard as low hanging fruit.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c44fd39be3b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>