Exploiting PHP preg_replace( ) function

 Introduction:

The preg_replace() function returns a string or array of strings where all matches of a pattern or list of patterns found in the input are replaced with substrings. 

Usage: preg_replace(patterns, replacements, input, limit, count)

This is a userful function but when handled incorrectly could cause severe damage as great as RCE.

Exploitation:

For example see this: 

this will output: world world
No problem, right? But the problem arises if we use this /e modifier in the PHP preg_funtions which allows the PHP code to be executed.

So now lets add the /e modifier and read the contents of index.php
Output
et Voila!
 This was just an example but in real life same thing could be used but with some more complex payloads.
Have nice day.
                                        -DarkRider88

Comments

  1. ᐈ Casino Review | Online Slots | OKLAHOMA Casino
    Casino 블랙 잭 게임 Review by OnlineSlots.com. Find everything you need to 안전 바카라 know about this casino before 룰렛 돌리기 게임 you play. Find 슬롯사이트 out which casino games w88 com login offer the most

    ReplyDelete

Post a Comment

Popular posts from this blog

THM: Blog Room Writeup

Carpe-Diem | Tryhackme | Writeup

GamingServer | TryHackMe | by Valerie23