<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Express on Zach Grace</title><link>https://zachgrace.com/tags/express/</link><description>Recent content in Express on Zach Grace</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 01 Mar 2017 00:00:00 +0000</lastBuildDate><atom:link href="https://zachgrace.com/tags/express/index.xml" rel="self" type="application/rss+xml"/><item><title>Backdooring Node.js Express Apps via SSJI</title><link>https://zachgrace.com/posts/backdooring-nodejs-express-apps/</link><pubDate>Wed, 01 Mar 2017 00:00:00 +0000</pubDate><guid>https://zachgrace.com/posts/backdooring-nodejs-express-apps/</guid><description>&lt;p>&lt;em>Updated: 2017.03.03&lt;/em>&lt;/p>
&lt;p>One of the interesting things about &lt;a href="https://nodejs.org/en/">Node.js&lt;/a> (server-side JavaScript) apps/APIs is that they&amp;rsquo;re event driven. As an attacker, this means there are new options for post-exploitation code execution, so I wrote a little PoC to demonstrate that.&lt;/p>
&lt;p>In the scenario below, we&amp;rsquo;re going to assume we&amp;rsquo;ve already identified Server-Side JavaScript Injection (SSJI) in the app. This is not a new vulnerability in Express, but an experiment in post-exploitation. There are many posts on how to exploit SSJI in which they show how to read files with &lt;code>require(‘fs’).readFile&lt;/code> or execute commands with &lt;code>require('child_process').spawn&lt;/code>. But what if we could add our own event through the SSJI? We could modify the running app&amp;rsquo;s behavior without touching disk and have it harvest sensitive information or perform other nefarious activities.&lt;/p></description></item></channel></rss>