mysql中的数据库突然没了,里面出现了一个wns数据库To recover your lost Database and avoid leaking it: Send us 0.1 Bitcoin

    xiaoxiao2023-10-30  133

    近日服务器收到攻击,数据库被清空并插入了一个表,内容如下:

    To recover your lost Database and avoid leaking it: Send us 0.1 Bitcoin (BTC) to our Bitcoin address 1J6jLduCXbPyxt5EMTs7iHwdafANy4ThJc and contact us by Email with your Server IP or Domain name and a Proof of Payment. If you are unsure if we have your data, contact us and we will send you a proof. Your Database is downloaded and backed up on our servers. Backups that we have right now: xxx,xxx,xxx . If we dont receive your payment in the next 10 Days, we will make your database public or use them otherwise.

    大致的意思呢就是,你的数据库被黑了,现在需要你登录一个网站支付折合人民币为800元,即可解锁.

    如果你现在还不是一个顶级大佬的话,不要想着数据恢复了,80%不可能的,因为作者已经找了n多的方法试过,都没成功,问了问淘宝,找回数据需要几百块钱,问了腾讯云官方,说:这不怪他们.算了认栽吧反正也是自己的小数据库,没什么东西, 但是我们该如何预防这种事情呢?

    **造成的原因:**是因为mysql账号密码被暴力破解和允许远程访问, 简单的说可能你的用户名和密码都是root和root,并且端口号也是3306,这样破解不是轻而易举吗?

    为了防止这样的操作,我们进行如下配置

    1.登录数据库 $ mysql -u 你的账号 -p $ 你的密码

    有一个特殊的数据库,数据库名为mysql,表名为user,它存储了服务器数据库有用户信息和访问权限

    use mysql; select user,host from user;

    2.host为允许访问的主机地址,’%代表全部允许,如果发现host的信息为%,那这就是问题所在了,首先把root前面的%改为localhost然后将除了root用户以外的其他用户全部删除(这里不改也可以重点是用户名和密码)

    update user set host='localhost' where user = 'root'; delete from user where user != 'root';

    3.除了这个表之外,我们还需要去db表相应删除

    delete from db where user != 'root';

    4.刷新缓存,让配置生效

    flush privileges;

    5.当前的mysql的用户名字和密码已经泄露了,所以要修改密码 退出数据库: exit; 修改密码 mysqladmin -u root -p password 新密码

    6.修改端口号(到下图路径下) 7.先检查一下端口是否被占用

    netstat -tunlp |grep 3305

    8.vim mysqld.cnf在port位置改变端口号的数值即可我这里修改为3305,

    9.然后更换用户的IP地址(这里可以是ipconfig查询出来的ipv4)

    update user set host = '你的ip' where user = 'root';

    10.刷新缓存

    flush privileges;

    最后一步重启服务

    systemctl restart mysql

    然后就发现3306连接不上了,只有你的ip地址可以连接上

    最新回复(0)