LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 11-27-2021, 07:15 PM   #1
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Rep: Reputation: 54
Keep getting hacked, want some insight on how they might be getting in


I have a server at OVH that hosts all my websites as well as other people's. Nothing super serious but it's basically my main online presence. Long story short my web server was running fairly old software (CentOS 6.x fully updated to last point they issued updates for it) and was due to be upgraded and I was procrastinating. Got hacked. So without any choice I order a new server to start migrating stuff to (from offline backups) and it gets hacked again. This time it was running new software, Debian 11 and everything was vanilla since I was still in the process of setting it up. Both attacks appear to be similar in nature.


When I look at the apache logs, I see something like this:


Code:
x.x.x.x - - [27/Nov/2021:17:52:20 +0000] "GET /?level=picture&id=1052 HTTP/1.1" 200 623 "-" "Mozilla/5.0 (compatible; Barkrowler/0.9; +https://babbar.tech/crawler)"

^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@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^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@x.x.x.x - - [27/Nov/2021:17:57:03 +0000] "GET /shard.php?id=1334&act=vote HTTP/1.1" 404 740 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36"


In the syslog:


Code:
Nov 27 17:56:53 server04 dovecot: pop3-login: Disconnected (no auth attempts in 2 secs): user=<>, rip=x.x.x.x, lip=x.x.x.x, session=<UL3Q7sjRwlorgSFj>

^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@


Followed by many white spaces

I'm guessing these are special characters and vim is just representing them that way. It looks like some kind of injection of sorts.


I figured the first one was simply due to it being a known exploit and fact that I had not updated the OS in a while, but now that it happened to the 2nd one with newer everything, I'm really starting to wonder what in the world is going on. Clearly somebody is attacking me and this is targetted and a rather sophisticated attack.


Anyone ever see anything like this before?


After this attack the server basically becomes inaccessible. I think they did something to SSH so the keys don't work to login to the server, and changed the password. (still had the password auth enabled temporarily). I do not see any signs of brute force attempts. This really seems like some kind of auth bypass attack.



Oh and this bit of log in /var/secure is probably what did the first server in, looks like they were able to load something malicious in /usr/sbin and run it. It also seems to have done somewhere where SSH failed, and so did apache and pretty much everything, except DNS kept working and server was still pinging at that point.



Code:
Nov 24 09:52:02 server03 runuser: pam_unix(runuser:session): session opened for user root by (uid=0)

Nov 24 09:52:02 server03 runuser: pam_unix(runuser:session): session closed for user root

Nov 24 09:52:03 server03 sshd[2009]: error: Bind to port 87 on 192.95.14.97 failed: Permission denied.

Nov 24 09:52:03 server03 sshd[2009]: fatal: Cannot bind any address.

Nov 24 09:52:43 server03 userhelper[2506]: running '/usr/sbin/setup ' with root privileges on behalf of 'root'

Nov 25 21:40:50 server03 runuser: pam_unix(runuser:session): session opened for user root by (uid=0)

Nov 25 21:40:50 server03 runuser: pam_unix(runuser:session): session closed for user root

Nov 25 21:40:52 server03 sshd[2077]: error: Bind to port 87 on 192.95.14.97 failed: Permission denied.

Nov 25 21:40:52 server03 sshd[2077]: fatal: Cannot bind any address.

Nov 25 21:41:01 server03 userhelper[2574]: running '/usr/sbin/setup ' with root privileges on behalf of 'root'


I kept a backup of that file so I can try running it in a VM to see what it does, but have not gotten to it yet.



I had the 2nd server in rescue mode, which is a mode that the data centre offers where it boots into a rescue image and then I can SSH in with a provided long password. That got hacked too. Somebody is clearly attacking me right now with some kind of sophisticated attack. I booted it back up in rescue mode and I'm watching /var/log/syslog now just to see if I spot anything weird. I don't think this is a SSH brute force attack unless that weird stuff I'm seeing in the logs is a way to erase the logs. (maybe issuing a bunch of backspaces as part of the username?)


Live, I would be seeing the attempts though. So I will let this run overnight again to see what happens.


They have not touched the original server which is now in rescue mode though... this whole thing is just so strange. At this point I just want to try to figure out how they got in, I don't think it's just the thing of it being out of date considering the same attack worked on the new server.
 
Old 11-27-2021, 07:44 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,384
Blog Entries: 28

Rep: Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164
A web search turns up the information that babbar.tech purports be a site for pen testing.

Was any damage done?

What security precautions have you taken (firewall, fail2ban, etc.)?
 
Old 11-27-2021, 08:00 PM   #3
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
It's hard to tell the damage as they seem very good at hiding their traces. Basically from a user perspective, apache was down hard, SSH was also down, and so was mail (SMTP and POP3). In rescue mode I do have access to the file system so I do have the option to poke around more if there is anything specific I can maybe look at. I have not really found anything new, and even that setup file has an old date, so I wonder if they turned the clock back randomly so that file dates do not stand out.

On the 2nd server, the damage seemed to be minimal as apache still worked, except it looks like they changed the SSH password or at least changed some settings so that I can no longer log in. SSH itself was running but was not able to log in at all. I managed to look via rescue mode and the keys appeared to be there though so it's very strange, but when I tried to login it would not let me login with either the SSH keys or with the password. I had not disabled that yet.

I had fail2ban setup on the original server, SSH was also on a non default port, and I also had key auth setup only, no passwords. I don't see anything in the logs about brute force, though I have had it happen before where people were trying, but it was a really strange attack since they were only trying like every minute and it was random usernames that were not valid.

The attack seems to originate through apache as the time stamp in the log after that big text is basically the time stamp the server stopped responding to my monitoring system.


Edit: The 1st rescue session got hacked now. (basically to get into the 1st server)

At this point I just want to try to get as much forensics data as I can and cancel both and find another hobby.

Last edited by Red Squirrel; 11-27-2021 at 08:21 PM.
 
Old 11-27-2021, 08:23 PM   #4
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,384
Blog Entries: 28

Rep: Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164
It sounds as if you took every reasonable precaution, and it does seem to have been a malicious attack in the light of the damage you report. By "malicious," I do not mean it was directed at you personally, but that they were up to no good. Bad guys love to penetrate web servers because it gives them access to the site's visitors.

A web search for "how to attack apache" might turn up some helpful articles.

I am no pen-testing expert. Hopefully, someone who is will join this thread with some suggestions as to how they got in.
 
Old 11-27-2021, 09:55 PM   #5
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
Managed to get a rescue session up and quickly firewalled out every IP but my home one. Now I can rsync my stuff back to my home server without interruption then cancel this server and get a refund for the prepaid months. This will give me more time to do a post mortem and try to figure out wth happened. I consider all that data compromized of course and will not restore it anywhere.

As a side note this incident is a very good reminder to everyone to check your backups once in a while. Thankfully mine worked, though I was only pulling them once a week, and I perhaps should have been doing it every day.

What a last couple days this has been. I just wish the person that is attacking me would show themselves and tell me WTF they want. But at this point I'm more concerned about HOW they are getting in, because they keep doing it very quickly when I get a fresh server up.
 
Old 11-28-2021, 06:30 AM   #6
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
I fail to see how any of this makes sense, if OVH were this poor at default server setup no one would buy from them. Just how do you get a rescue mode on a hacked remote server with no access without help from the data centre where it is located and why the hell would they not be interested in their servers getting hacked in an instant upon the setup of them. So you need to come to some forum to get help with this.
 
1 members found this post helpful.
Old 11-28-2021, 08:20 AM   #7
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
No idea. Not looking for any arguments just want to get some pointers on how I can further analyze this. This is very targeted and is a sophisticated attack otherwise a lot of their servers would be getting hacked too. The hacker is clearly aware of some kind of unpatched exploit in a default service such as Apache.
 
Old 11-28-2021, 08:31 AM   #8
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by Red Squirrel View Post
No idea. Not looking for any arguments just want to get some pointers on how I can further analyze this. This is very targeted and is a sophisticated attack otherwise a lot of their servers would be getting hacked too. The hacker is clearly aware of some kind of unpatched exploit in a default service such as Apache.
Well then it is time to talk to the people at the Apache Foundation and OVH, you claim to have a 100% record of getting hacked with both of their products used in combination. I would think they will want to investigate this matter to solve the problem. Supposedly you have the perfect setup to catch this in the act. Not asking about it on some forum where you will get no where near the level of analysis they can do on this. That is if you actually want to get the problem solved and not just do further postings here.
 
Old 11-28-2021, 11:03 AM   #9
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
Well in order to do a proper bug report I'm going to want to have concrete evidence and a way to reproduce it otherwise how are they suppose to fix the bug? I do not know 100% yet what the attack vector is and only assuming, this is why I'm hoping someone that knows more than me about Linux/security can help.

The host also won't refund me as I prepaid for 3 months on the new box, so that one will remain available for post mortem. I decided to poke around more on that one and found this in the /var/log/auth.log:


Code:
Nov 27 17:52:20 server04 sshd[40160]: Failed password for root from 185.251.45.83 port 59679 ssh2
Nov 27 17:52:22 server04 sshd[40160]: Connection closed by authenticating user root 185.251.45.83 port 59679 [preauth]
Nov 27 17:52:25 server04 sshd[40162]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=185.251.45.83  user=root
Nov 27 17:52:27 server04 sshd[40162]: Failed password for root from 185.251.45.83 port 32933 ssh2
Nov 27 17:52:29 server04 sshd[40162]: Connection closed by authenticating user root 185.251.45.83 port 32933 [preauth]
Nov 27 17:52:32 server04 sshd[40164]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=185.251.45.83  user=root
Nov 27 17:52:34 server04 sshd[40164]: Failed password for root from 185.251.45.83 port 34284 ssh2
Nov 27 17:52:36 server04 sshd[40164]: Connection closed by authenticating user root 185.251.45.83 port 34284 [preauth]
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^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@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@Nov 27 17:56:12 server04 systemd-logind[882]: New seat seat0.
Nov 27 17:56:12 server04 systemd-logind[882]: Watching system buttons on /dev/input/event3 (Power Button)
Nov 27 17:56:12 server04 systemd-logind[882]: Watching system buttons on /dev/input/event2 (Sleep Button)
Nov 27 17:56:12 server04 systemd-logind[882]: Watching system buttons on /dev/input/event4 (Intel Virtual Button driver)
Nov 27 17:56:12 server04 sshd[940]: Server listening on [server ip] port 22.
Nov 27 17:56:35 server04 sshd[1874]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=[my home ip]  user=debian
Nov 27 17:56:37 server04 sshd[1874]: Failed password for debian from [my home ip] port 14917 ssh2
Nov 27 17:56:39 server04 sshd[1874]: Connection closed by authenticating user debian [my home ip] port 14917 [preauth]

Someone was trying to brute force their way in, which on it's own would not be an issue once fail2ban is setup, and root logins are not permitted on that server anyway. However, he did something at some point which generated all those ^@ and at that point I lost my connection to the server, and was no longer able to log back in. I would hit the SSH server but it would reject my password. So whatever the attack was it also reset the password and deleted the SSH keys. Not sure what else or how long they were in the box or what data they may have taken. (there was not lot of data yet as I was still restoring backups)

This is on the new server so I believe they may have attacked it through a different attack vector, I was just assuming Apache but maybe it's SSH. But it's weird since lot of other logs have these symbols too so wonder if the attack requires attacking more than one service at once, then they must issue some characters that erase the logs and replace with null characters.

Either way this is all speculation this is why I'm asking for some insight on more specific things to check.

Last edited by Red Squirrel; 11-28-2021 at 11:05 AM.
 
Old 11-28-2021, 11:39 AM   #10
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Code:
MacUser2525:~$ whois 185.251.45.83
% IANA WHOIS server
% for more information on IANA, visit http://www.iana.org
% This query returned 1 object

refer:        whois.ripe.net

inetnum:      185.0.0.0 - 185.255.255.255
organisation: RIPE NCC
status:       ALLOCATED

whois:        whois.ripe.net

changed:      2011-02
source:       IANA

# whois.ripe.net

inetnum:        185.251.44.0 - 185.251.45.255
netname:        SRVC-1
org:            ORG-KGL11-RIPE
country:        HK
admin-c:        PD358
tech-c:         PD358
status:         ASSIGNED PA
mnt-by:         PawelD-MNT
mnt-by:         mnt-us-sammu-1
created:        2018-12-03T19:46:57Z
last-modified:  2020-02-22T09:33:26Z
source:         RIPE # Filtered

organisation:   ORG-KGL11-RIPE
org-name:       KWAIFONG GROUP LIMITED
org-type:       OTHER
address:        Rm 34, 4/F, Beverley Commercial Centre 87-105 Chatham Road, Tsim Sha Tsui, Kowloon,Hong Kong
abuse-c:        KGLA1-RIPE
mnt-ref:        PawelD-mnt
mnt-by:         PawelD-mnt
created:        2019-01-02T19:31:28Z
last-modified:  2019-01-02T19:31:28Z
source:         RIPE # Filtered

person:         Pawel Damian
address:        Poznan, Poland
phone:          +48616419200
nic-hdl:        PD358
mnt-by:         PawelD-MNT
created:        2006-06-07T10:34:33Z
last-modified:  2019-08-09T13:04:00Z
source:         RIPE

% Information related to '185.251.44.0/23AS133115'

route:          185.251.44.0/23
descr:          ServiceID-ISER
origin:         AS133115
mnt-by:         PawelD-mnt
created:        2019-03-27T08:54:40Z
last-modified:  2019-03-27T08:54:40Z
source:         RIPE

% This query was served by the RIPE Database Query Service version 1.101 (HEREFORD)
There is no need for bug report you say it happens as soon as the server is setup. This implies OVH are complete and totally incompetent in provisioning a secure by default server instance. Something I find completely hard to believe, they would not still be in business if this was the case. For them not to want to investigate this happening at all is another completely hard to believe scenario. At the very least you have case for a charge back on whatever the means of payments was. According to you they have delivered nothing of value for your purchase.
 
Old 11-28-2021, 11:53 AM   #11
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
This is a highly targetted attack so maybe this is not a known flaw yet and it does not have an update. I don't think this is OVH's fault. I suppose I can just move on from it but I feel like I am in a position where I could discover a new flaw and report it to the appropriate developer. This may be something similar to heart bleed or shell shocker. Those flaws went unnoticed for years before someone finally found them.

On the original server it may very well be shell shocker I got hit with as I'm not sure if the patching level went that far, it was really old (CentOS 6.6) and well overdue to be upgraded. But the new one is what baffles me.
 
Old 11-29-2021, 08:58 PM   #12
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
There's a log I realized I forgot to look at this whole time. This is a client application and not a server application, but it stopped polling when the server was hit with the hack. (this is on the original server) I was curious to see what kind of errors there would be, I assumed it would just be failing to connect to servers, but no, something very different....

https://i.imgur.com/EzsvsHS.png

Really messed up. I was thinking MAYBE someone managed to find a flaw in my program by acting as a bad client (the nature of my app is for game servers so you can submit a game server to it and the app connects to gather data) and sending bad data to it, but that still would not explain how they hacked the 2nd server (the app was not running yet).

I'm thinking this is more a symptom of the attack, it may have scrambled the memory or something in the process as maybe part of the attack involved loading code into memory by specifying an arbitrary start memory address then executing it. I don't really know that much about hacking at this level so it's a bit beyond my knowledge. This is not just a simple brute force attack it was actual real hacking. There were a lot of brute force attempts in the logs but think that was just noise and "normal" stuff, as I had not changed the default port yet. None of the attempts were trying the proper username either and root login was disabled.

Last edited by Red Squirrel; 11-29-2021 at 09:00 PM.
 
Old 12-02-2021, 02:24 AM   #13
gpbabbar
LQ Newbie
 
Registered: Dec 2021
Posts: 1

Rep: Reputation: Disabled
Hi, I'm the CTO of babbar.tech

Not sure the origin of the attack is still debated and if we are actually a source of concern, but just to square up things :

Babbar.tech is not a pen testing site, we just (mainly) operate a web crawler to index the web graph. Our crawler is barkrowler, it shouldn't trigger any such problem on a server.

Either the log line is completely unrelated to your problem, or it's someone faking our user-agent, or, but that seems unlikely, it's a bug in our crawler triggered by some condition that has never occurred elsewhere (we crawl approximately a billion pages each day so I'm quite doubtful).

Anyway, if you think we may help in any way, do not hesitate to contact me.
Guillaume

Quote:
Originally Posted by frankbell View Post
A web search turns up the information that babbar.tech purports be a site for pen testing.

Was any damage done?

What security precautions have you taken (firewall, fail2ban, etc.)?
 
1 members found this post helpful.
Old 12-02-2021, 07:44 PM   #14
Linux_Kidd
Member
 
Registered: Jan 2006
Location: USA
Posts: 737

Rep: Reputation: 78
17:52 to 17:56 jump in logs, with a "systemd-logind[882]: New seat seat0" in /var/log/auth.log?

Who rebooted the system? ~4min to reboot? Or did bad actor erase 4min worth of logs replaced with "@^@^@^@^@^@^@^@^@^@^@^@^@" ?

Last edited by Linux_Kidd; 12-02-2021 at 07:45 PM.
 
Old 12-02-2021, 10:43 PM   #15
Linux_Kidd
Member
 
Registered: Jan 2006
Location: USA
Posts: 737

Rep: Reputation: 78
Quote:
Originally Posted by gpbabbar View Post
Hi, I'm the CTO of babbar.tech
Babbar.tech
Guillaume
The site needs work Guillaume. Land the homepage and I click "US" in upper right, yet the bottom 1/4 page notice "Paramètres du cookies" still renders in French?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Programming a limits problem in C. Need some insight please. jahobjafwar Programming 27 09-22-2011 08:11 PM
[SOLVED] After-Update tweaks...some insight is welcome ButterflyMelissa Arch 2 08-14-2011 04:52 AM
[SOLVED] My network is hacked for sure. I want to reinstall but it will be hacked again. MsRefusenik Linux - Security 19 10-18-2010 05:02 PM
Some insight on whats going wrong [Not a coding problem, but concept problem] imoracle Linux - Newbie 5 11-13-2008 11:49 PM
I'm hoping that some people may have insight to help me craft a career path Mohtek General 1 03-05-2008 09:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 11:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration