<?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 Dwight A Spencer on Medium]]></title>
        <description><![CDATA[Stories by Dwight A Spencer on Medium]]></description>
        <link>https://medium.com/@dwightaspencer?source=rss-fe230a89b643------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*_SMEEaMpGWJ7w6Op.jpg</url>
            <title>Stories by Dwight A Spencer on Medium</title>
            <link>https://medium.com/@dwightaspencer?source=rss-fe230a89b643------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 22:57:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dwightaspencer/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[Hacking AWS for fun and profit]]></title>
            <link>https://medium.com/@dwightaspencer/earlier-today-i-was-requested-to-prove-that-aws-lamba-is-running-in-shared-resource-space-b3ee818b7375?source=rss-fe230a89b643------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3ee818b7375</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[infosec]]></category>
            <dc:creator><![CDATA[Dwight A Spencer]]></dc:creator>
            <pubDate>Wed, 06 Jul 2016 18:21:52 GMT</pubDate>
            <atom:updated>2016-07-07T22:08:29.531Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*6j-kYRt0OEIf6XOPH8hBSQ.jpeg" /></figure><p>Earlier today I was requested to prove that AWS Lamba is running in shared resource space.</p><p>While select parts of this article will not feature how to break out of the jails in place out of respect for a few NDA’s and other contractual agreements I am under. Nor would we go into how to setup AWS Lamba as there are several articles already out there for that.</p><p>Initially I took the approach of a black box method of analysing the service. This lead to discover a few things about host running our code and the capabilities of our user.</p><h4>Lamba Function</h4><blockquote>‘use strict’;<br>let exec = require(‘child_process’).exec;</blockquote><blockquote>exports.handler = (event, context, callback) =&gt; {<br>const child = exec(“id &amp;&amp; cat /etc/passwd;cat /proc/1/cgroup &amp;&amp; cat /proc/1/sched | head -n 1”, (error, stdout, stderr) =&gt; { <br> // Resolve with result of process<br> if (error) callback(error, ‘Process complete!’);<br> callback(error, stdout);<br> });</blockquote><blockquote>// Log process stdout and stderr<br> child.stdout.on(‘data’, console.log);<br> child.stderr.on(‘data’, console.error);<br>};</blockquote><h4>Log output</h4><pre>:/sbin/nologin<br>sbx_user1086:x:461:460::/home/sbx_user1086:/sbin/nologin<br>sbx_user1087:x:460:459::/home/sbx_user1087:/sbin/nologin<br>sbx_user1088:x:459:458::/home/sbx_user1088:/sbin/nologin<br>sbx_user1089:x:458:457::/home/sbx_user1089:/sbin/nologin<br>sbx_user1090:x:457:456::/home/sbx_user1090:/sbin/nologin<br>sbx_user1091:x:456:455::/home/sbx_user1091:/sbin/nologin<br>sbx_user1092:x:455:454::/home/sbx_user1092:/sbin/nologin<br>sbx_user1093:x:454:453::/home/sbx_user1093:/sbin/nologin<br>sbx_user1094:x:453:452::/home/sbx_user1094:/sbin/nologin<br>sbx_user1095:x:452:451::/home/sbx_user1095:/sbin/nologin<br>sbx_user1096:x:451:450::/home/sbx_user1096:/sbin/nologin<br>sbx_user1097:x:450:449::/home/sbx_user1097:/sbin/nologin<br>sbx_user1098:x:449:448::/home/sbx_user1098:/sbin/nologin<br>sbx_user1099:x:448:447::/home/sbx_user1099:/sbin/nologin<br>sbx_user1100:x:447:446::/home/sbx_user1100:/sbin/nologin<br>sbx_user1101:x:446:445::/home/sbx_user1101:/sbin/nologin<br>sbx_user1102:x:445:444::/home/sbx_user1102:/sbin/nologin<br>sbx_user1103:x:444:443::/home/sbx_user1103:/sbin/nologin<br>sbx_user1104:x:443:442::/home/sbx_user1104:/sbin/nologin<br>sbx_user1105:x:442:441::/home/sbx_user1105:/sbin/nologin<br>sbx_user1106:x:441:440::/home/sbx_user1106:/sbin/nologin<br>sbx_user1107:x:440:439::/home/sbx_user1107:/sbin/nologin<br>sbx_user1108:x:439:438::/home/sbx_user1108:/sbin/nologin<br>sbx_user1109:x:438:437::/home/sbx_user1109:/sbin/nologin<br>sbx_user1110:x:437:436::/home/sbx_user1110:/sbin/nologin<br>sbx_user1111:x:436:435::/home/sbx_user1111:/sbin/nologin<br>sbx_user1112:x:435:434::/home/sbx_user1112:/sbin/nologin<br>sbx_user1113:x:434:433::/home/sbx_user1113:/sbin/nologin<br>sbx_user1114:x:433:432::/home/sbx_user1114:/sbin/nologin<br>sbx_user1115:x:432:431::/home/sbx_user1115:/sbin/nologin<br>sbx_user1116:x:431:430::/home/sbx_user1116:/sbin/nologin<br>sbx_user1117:x:430:429::/home/sbx_user1117:/sbin/nologin<br>sbx_user1118:x:429:428::/home/sbx_user1118:/sbin/nologin<br>sbx_user1119:x:428:427::/home/sbx_user1119:/sbin/nologin<br>sbx_user1120:x:427:426::/home/sbx_user1120:/sbin/nologin<br>sbx_user1121:x:426:425::/home/sbx_user1121:/sbin/nologin<br>sbx_user1122:x:425:424::/home/sbx_user1122:/sbin/nologin<br>sbx_user1123:x:424:423::/home/sbx_user1123:/sbin/nologin<br>sbx_user1124:x:423:422::/home/sbx_user1124:/sbin/nologin<br>sbx_user1125:x:422:421::/home/sbx_user1125:/sbin/nologin<br>sbx_user1126:x:421:420::/home/sbx_user1126:/sbin/nologin<br>sbx_user1127:x:420:419::/home/sbx_user1127:/sbin/nologin<br>sbx_user1128:x:419:418::/home/sbx_user1128:/sbin/nologin<br>sbx_user1129:x:418:417::/home/sbx_user1129:/sbin/nologin<br>sbx_user1130:x:417:416::/home/sbx_user1130:/sbin/nologin<br>sbx_user1131:x:416:415::/home/sbx_user1131:/sbin/nologin<br>sbx_user1132:x:415:414::/home/sbx_user1132:/sbin/nologin<br>sbx_user1133:x:414:413::/home/sbx_user1133:/sbin/nologin<br>sbx_user1134:x:413:412::/home/sbx_user1134:/sbin/nologin<br>sbx_user1135:x:412:411::/home/sbx_user1135:/sbin/nologin<br>sbx_user1136:x:411:410::/home/sbx_user1136:/sbin/nologin<br>sbx_user1137:x:410:409::/home/sbx_user1137:/sbin/nologin<br>sbx_user1138:x:409:408::/home/sbx_user1138:/sbin/nologin<br>sbx_user1139:x:408:407::/home/sbx_user1139:/sbin/nologin<br>sbx_user1140:x:407:406::/home/sbx_user1140:/sbin/nologin<br>sbx_user1141:x:406:405::/home/sbx_user1141:/sbin/nologin<br>sbx_user1142:x:405:404::/home/sbx_user1142:/sbin/nologin<br>sbx_user1143:x:404:403::/home/sbx_user1143:/sbin/nologin<br>sbx_user1144:x:403:402::/home/sbx_user1144:/sbin/nologin<br>sbx_user1145:x:402:401::/home/sbx_user1145:/sbin/nologin<br>sbx_user1146:x:401:400::/home/sbx_user1146:/sbin/nologin<br>sbx_user1147:x:400:399::/home/sbx_user1147:/sbin/nologin<br>sbx_user1148:x:399:398::/home/sbx_user1148:/sbin/nologin<br>sbx_user1149:x:398:397::/home/sbx_user1149:/sbin/nologin<br>sbx_user1150:x:397:396::/home/sbx_user1150:/sbin/nologin<br>9:perf_event:/<br>8:memory:/sandbox-c6f787<br>7:hugetlb:/<br>6:freezer:/sandbox-e28e26<br>5:devices:/<br>4:cpuset:/<br>3:cpuacct:/sandbox-543103<br>2:cpu:/sandbox-root-LL3fkc/sandbox-052bdb<br>1:blkio:/<br>node (25342, #threads: 9)</pre><p>The result of the command above shows that there are multiple users on the same shared ec2 instance resource. Further discover shows that each process executed is locked within a cpu, process, blkio, and memory cgrouping. However network namespaces do not appear to be enabled and further evidence shows we are executing inside a docker container.</p><p>Several exploits exist for escaping out of docker and cgroup jails. All of which I leave to you the reader to discover on your own.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3ee818b7375" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adventures into Ansible]]></title>
            <link>https://medium.com/@dwightaspencer/one-of-the-current-projects-i-have-been-working-on-for-a-client-has-a-requirement-to-use-different-c305237713d5?source=rss-fe230a89b643------2</link>
            <guid isPermaLink="false">https://medium.com/p/c305237713d5</guid>
            <category><![CDATA[playbook]]></category>
            <category><![CDATA[ansible]]></category>
            <category><![CDATA[variables]]></category>
            <dc:creator><![CDATA[Dwight A Spencer]]></dc:creator>
            <pubDate>Fri, 18 Mar 2016 20:08:14 GMT</pubDate>
            <atom:updated>2016-03-19T01:03:05.522Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tgt22j2J6YU3zX2shTy28A.png" /></figure><p>One of the current projects I have been working on for a client has a requirement to use different environment variables per task within a playbook.</p><p>Since most of these environment variables are for configuring a proxy or setting up path lookups. The overall way of doing this is writing a dictionary with your settings and then using them individually:</p><pre>- vars:<br>    node_version: 4.2.1<br>    proxy_env:<br>      http_proxy: <a href="http://my.proxy.local:8000/">http://my.proxy.local:8000</a><br>      no_proxy: 127.0.0.1,localhost,.consul<br>    app_env:<br>      NVM_DIR: /usr/local/nvm<br>- tasks:<br>    - name: get something<br>      environment: &quot;{{ proxy_env }}&quot;<br>      get_url: url=&quot;http://get.me/this.html&quot;<br>    - name: run node app<br>      environment: &quot;{{ app_env }}&quot;<br>      shell: &quot;/bin/bash -c &#39; . $NVM_DIR/nvm.sh; nvm exec {{node_version}} npm start&#39;</pre><p>Well this works for the most part but doesn’t help if one needs to include a proxy and keep their playbooks dry.</p><p>The best way to merge two facts that I have found is to use the jinja2 templating system with a <a href="http://docs.ansible.com/ansible/set_fact_module.html">set_fact</a> command such as:</p><pre>- tasks:<br>  - set_fact:<br>      app_and_proxy_env: &quot;{% set _dummy = proxy_env.update(app_env) %}{{proxy_env}}&quot;<br>  - name: run node app<br>    environment: &quot;{{ app_and_proxy_env }}&quot;<br>    shell: &quot;/bin/bash -c &#39; . $NVM_DIR/nvm.sh; nvm exec {{node_version}} npm start&#39;</pre><p>What happens here is that ansible will generate a new dictionary variable named ‘app_and_proxy_env’ which has the combined values of both ‘proxy_env’ and ‘app_env’ with any matching values in ‘proxy_env’ being overwritten by the ones found in ‘app_env’.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c305237713d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>