Linux ssh tunnel backdoor and Detection

Source: Internet
Author: User

I just discussed it with the two heroes in the group. I will summarize it and share it with you.


Now there is an intranet machine S6 and an Internet machine S7. We need to connect from S6 back to S7.

Run

Ssh-R 4022: localhost: 22 s7

At this time, the system will log in to S7, and a 4022 tunnel port will be opened locally in S7 to access IPv6.

Then execute ssh localhost-p 4022 in S7 and connect to IPv6.

Of course, you can also make a socks5 proxy to transfer it out, but I don't need it. If you need it, try man ssh on your own. In addition, you can also avoid shell, which is more concealed, or change the parameter.

In this scenario:

1. ssh is replaced and no logs are logged.

2. Write a simple C program and compile it into ELF. Then, execute the ssh injection and exit. J: If this ELF is encrypted, strings won't be available.

3. Use crontab to regularly execute this ELF. What if it is placed below?

[Root @ S6 ~] # Ls/etc/cron
Cron. d/cron. deny cron. monthly/crontab
Cron. daily/cron. hourly/cron. weekly/

How can we discover and defend against such backdoors? What should I do before, during, and after?

Beforehand:

As a management private network, the managed server can only accept active access from the management private network management end.

Access control: the firewall is completely prohibited from going out, and you are also prohibited from actively accessing the management end.

Well, these two are relatively effective, but there are certain costs and conditions.

In-process:

Check whether ssh has been replaced.

Grep/proc/line feature searching

Afterwards:

Check whether ssh is replaced. If no, check the log.

If... What if this is a reconnection Trojan? Only work in advance is effective. Ssh does not generate any additional files, but it is not that obvious. There are also processes, but not obvious. No need to hide files and processes :)

You can share your ideas. I think the host detection is too difficult.

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.