Tag Archive for mysql

SQL Triggers Used by Hackers to Compromise User Database

 

Over the past year, a broader pattern of WordPress malware with SQL triggers has occurred within infected databases to mask intrusive SQL queries. Whenever the trigger condition is fulfilled, these queries insert an admin-level user into a contaminated database. Users can use a MySQL database to store essential data, including CMS settings and a common CMS is used on their website (such as WordPress). Something that might change the MySQL database is whether injecting harmful code or removing the content of your Website, could also do severe harm to the website. 

Potential for protection is one factor why the MySQL database has its own unique username and password, which will deter someone from checking the MySQL database manually without the required login details. Unfortunately, if attackers have unauthenticated access, they can also read a wp-config.php file to understand the website's database authentication credentials — which can then be used to connect to the database using code from the attacker and malicious adjustments. 

An intruder with unwanted access to a website, who would like to create a permanent loophole if the files of the Website are washed, is indeed an example from real life.

An intruder's approach is to set an admin user in the CMS database of the website. Usually, these can be conveniently found in the administrative dashboard or SQL client. The unauthorized admin account is a loophole outside of the website and in the directory of the webserver. This knowledge is critical since owners of a compromised website will also forget the index. However, the exclusion of suspected users from the database of the website does not entail the removal of any potential backdoors. 

A SQL trigger is an automatically stored process that runs when certain database modifications are introduced. While there have been several useful implementations, that bad actors use SQL triggers to retain unwanted access after a compromise. To achieve this, attackers are placing a SQL trigger in a compromised website database and malicious activity is performed if specific conditions have been reached or an incident happens.

If attackers breach a site, they will bet on any database passwords that are stored in wp-config or other CMS configuration files — and once the hacker has obtained the data at any post-infection period, it can be extremely hard to identify if the hacker has harvested any valuable information. Users must change passwords, including the databases if a breach occurs. Failure to pursue this post-hack phase will allow an attacker to enter and change the website even after the user has assumed the infection was removed.

HowTo: Reinstall MySQL v5.x On Linux

My MySQL database installation has been corrupted. I would like to delete old mysql server. How do I reinstall MySQL database server version 5.x on Linux or Unix-like oses? A software upgrade broke my system. How can I uninstall and re-install mysql again to get fresh full mysql again?

Read answer to: "HowTo: Reinstall MySQL v5.x On Linux"

Tweet this    Share on Facebook

WordPress MySql Statement To Delete All Pending Comments

I have over 1800+ pending comments and most of them are spams in WordPress based blog. How do I delete all (mass delete) the pending comments using sql statements?

Read answer to: "WordPress MySql Statement To Delete All Pending Comments"

Tweet this    Share on Facebook

mysql: count number of rows in a table

mysql-big2

Which way to count a number of rows should be faster in MySQL?

SELECT COUNT(1) FROM TABLE_NAME

When you COUNT(1) it takes in count column indexes, so it will be the best result. Mysql engine actually stores row count, it doesn’t count all rows each time you try to count all rows.

here is the codes you can use it in a script to echo the count

$counter = mysql_query(“SELECT COUNT(*) AS id FROM table_name”);
$num = mysql_fetch_array($counter);
$count = $num["id"];
echo(“$count”);

setup web server centos with apache

apache

Install Apache, Mysql , PhP Web Server

# yum install httpd mod_ssl

#/etc/init.d/httpd start

# yum install mysql mysql-server

# chkconfig –levels 235 mysqld on
# /etc/init.d/mysqld start

configure mysql

Set the MySQL service to start on boot
chkconfig –levels 235 mysqld on
Start the MySQL service
service mysqld start
Log into MySQL
mysql -u root
Set the root user password for all local domains
SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘new-password‘);
SET PASSWORD FOR ‘root’@’localhost.localdomain’ = PASSWORD(‘new-password‘);
SET PASSWORD FOR ‘root’@’127.0.0.1′ = PASSWORD(‘new-password‘);
Drop the Any user
DROP USER ”@’localhost’;
DROP USER ”@’localhost.localdomain’;
Exit MySQL
exit