Skip to content

Weird sudo login attempts

So I just noticed this when I couldn't log in due to PAM's failed attempts lock out. There is some weird thing running that is trying to run sudo /usr/bin/echo test. I have no idea what is running it. I couldn't log in so I ran the command journalctl -b -q SYSLOG_FACILITY=10 SYSLOG_FACILITY=4 the output was quite weird. Ever since about 11 o'clock last night I have been getting messages like this in the log.

Jun 29 23:20:26 jasons-thinkpad sudo[612270]: pam_unix(sudo:auth): auth could not identify password for [jason]
Jun 29 23:20:29 jasons-thinkpad sudo[612270]:    jason : 1 incorrect password attempt ; TTY=pts/2 ; PWD=/home/jason ; USER=root ; COMMAND=/usr/bin/echo test

This has never occurred before.

The second of these messages is this.

Jun 29 23:20:41 jasons-thinkpad sudo[612286]: pam_unix(sudo:auth): auth could not identify password for [jason]
Jun 29 23:20:42 jasons-thinkpad sudo[612286]:    jason : 1 incorrect password attempt ; TTY=pts/2 ; PWD=/home/jason ; USER=root ; COMMAND=/usr/bin/echo test

Now, the part that says TTY=pts/2 has disappeared and is no longer there. I set up something to log whenever sudo is run so I could figure out the parent ID. The parent ID belongs to a bash session.

jason     612249  0.0  0.0   8404  2024 ?        S    Jun29   0:03 bash

The parent ID of that is PID 1.

​

This is my pacman log from recently so you can see what packages I installed. None of them are suspicious and all pkgbuilds have been reviewed.

[2021-06-29T15:16:23+0800] [PACMAN] Running 'pacman --sync -y -u --'
[2021-06-29T15:16:23+0800] [PACMAN] synchronizing package lists
[2021-06-29T15:16:24+0800] [PACMAN] starting full system upgrade
[2021-06-29T15:19:22+0800] [PACMAN] Running 'pacman --sync -y -u --'
[2021-06-29T15:19:22+0800] [PACMAN] synchronizing package lists
[2021-06-29T15:19:23+0800] [PACMAN] starting full system upgrade
[2021-06-29T15:19:36+0800] [PACMAN] Running 'pacman --remove -s -u -- act'
[2021-06-29T15:19:38+0800] [PACMAN] Running 'pacman --remove -s -u -- act-bin'
[2021-06-29T15:19:39+0800] [ALPM] transaction started
[2021-06-29T15:19:39+0800] [ALPM] removed act-bin (0.2.22-0)
[2021-06-29T15:19:40+0800] [ALPM] transaction completed
[2021-06-29T15:19:40+0800] [ALPM] running '30-systemd-update.hook'...
[2021-06-29T21:41:38+0800] [PACMAN] Running 'pacman --sync -- community/kodi-wayland'
[2021-06-29T21:41:46+0800] [ALPM] transaction started
[2021-06-29T21:41:46+0800] [ALPM] installed p8-platform (2.1.0.1-4)
[2021-06-29T21:41:46+0800] [ALPM] installed libcec (6.0.2-1)
[2021-06-29T21:41:46+0800] [ALPM] installed lirc (1:0.10.1-8)
[2021-06-29T21:41:46+0800] [ALPM] installed mariadb-libs (10.5.10-1)
[2021-06-29T21:41:46+0800] [ALPM] installed python-pillow (8.2.0-2)
[2021-06-29T21:41:46+0800] [ALPM] installed python-pycryptodomex (3.10.1-1)
[2021-06-29T21:41:46+0800] [ALPM] installed python-simplejson (3.17.2-4)
[2021-06-29T21:41:46+0800] [ALPM] installed shairplay (20180824.096b61a-3)
[2021-06-29T21:41:46+0800] [ALPM] installed tinyxml (2.6.2-7)
[2021-06-29T21:41:46+0800] [ALPM] installed kodi-common (19.1-1)
[2021-06-29T21:41:46+0800] [ALPM] installed pugixml (1.11.4-1)
[2021-06-29T21:41:46+0800] [ALPM] installed waylandpp (0.2.8-1)
[2021-06-29T21:41:46+0800] [ALPM] installed kodi-wayland (19.1-1)
[2021-06-29T21:41:47+0800] [ALPM] transaction completed
[2021-06-29T21:41:47+0800] [ALPM] running '30-systemd-daemon-reload.hook'...
[2021-06-29T21:41:47+0800] [ALPM] running '30-systemd-tmpfiles.hook'...
[2021-06-29T21:41:47+0800] [ALPM] running '30-systemd-update.hook'...
[2021-06-29T21:41:47+0800] [ALPM] running 'gtk-update-icon-cache.hook'...
[2021-06-29T21:41:47+0800] [ALPM] running 'update-desktop-database.hook'...
[2021-06-29T22:31:31+0800] [PACMAN] Running 'pacman --sync -- swappy'
[2021-06-29T22:31:32+0800] [ALPM] transaction started
[2021-06-29T22:31:32+0800] [ALPM] installed swappy (1.3.1-1)
[2021-06-29T22:31:33+0800] [ALPM] transaction completed
[2021-06-29T22:31:33+0800] [ALPM] running '30-systemd-update.hook'...
[2021-06-29T22:31:33+0800] [ALPM] running 'gtk-update-icon-cache.hook'...
[2021-06-29T22:31:33+0800] [ALPM] running 'update-desktop-database.hook'...
[2021-06-30T00:46:27+0800] [PACMAN] Running 'pacman --upgrade -- /home/jason/.cache/paru/clone/youtube-viewer/youtube-viewer-1:3.9.0-1-any.pkg.tar.zst'
[2021-06-30T00:46:40+0800] [PACMAN] Running 'pacman --upgrade -- /home/jason/.cache/paru/clone/youtube-viewer/youtube-viewer-1:3.9.0-1-any.pkg.tar.zst'
[2021-06-30T00:46:43+0800] [ALPM] transaction started
[2021-06-30T00:46:44+0800] [ALPM] removed gtk-youtube-viewer-git (3.9.2.r9.gc8db15f-1)
[2021-06-30T00:46:44+0800] [ALPM] installed youtube-viewer (1:3.9.0-1)
[2021-06-30T00:46:44+0800] [ALPM-SCRIPTLET] Because of the increasing popularity of youtube-viewer, the
[2021-06-30T00:46:44+0800] [ALPM-SCRIPTLET] developer's API key is occasionally exceeding its usage limit. Users
[2021-06-30T00:46:44+0800] [ALPM-SCRIPTLET] who are able are requested to create their own free API keys to reduce
[2021-06-30T00:46:44+0800] [ALPM-SCRIPTLET] the load. Please refer to
[2021-06-30T00:46:44+0800] [ALPM-SCRIPTLET] 
[2021-06-30T00:46:44+0800] [ALPM-SCRIPTLET] 	/usr/share/doc/youtube-viewer/README.md
[2021-06-30T00:46:44+0800] [ALPM-SCRIPTLET] 
[2021-06-30T00:46:44+0800] [ALPM-SCRIPTLET] for instructions.
[2021-06-30T00:46:44+0800] [ALPM] transaction completed
[2021-06-30T00:46:44+0800] [ALPM] running '30-systemd-update.hook'...
[2021-06-30T00:46:44+0800] [ALPM] running 'update-desktop-database.hook'...
[2021-06-30T00:46:44+0800] [PACMAN] Running 'pacman --database --asexplicit -- youtube-viewer'

I am about to kill the bash process, but does anyone have any idea why this is occurring? There is nothing in my crontab that should be doing this.

Edit: My god I'm an idiot. I tried this script that was meant to be some sudo exploit because I was curious and it added something to my bashrc. I thought it was meant to add something to my zshrc but nothing was there so I didn't think anything happened. Sigh....

Edited 3 Jul 2021. We only hold this version.

40 points27 comments
Open on Reddit
About this post
Posted
Archived
Edited
Score
40 · 89% up
Kind
Text
ID
oarmlu

Author

5
posts
113
comments
0
media
View profile

27 comments

Sounds like you tested a systemd timer or a cronjob or something

20 points

There aren't any cronjobs I have that should do this or that even use sudo. I don't remember starting this ever but I often do things I don't remember so how can I list all my running timers? I assume this is a user service becuase the bash session runs as my user

9 points

Sorry I forgot to exit out, let me kill that tab now :)

17 points

It is really weird because it used to belong to a pts but now it doesn't?

I opened a bash window a bit back to try making a keylogger by reading from /dev/pts but I didn't run a sudo command. last time I did that was months ago

6 points

Maybe search the entire system. Install ripgrep and run rg -i --hidden 'echo test' /

6 points

ooh that's nice. not 100% sure but does rip grep basically just run find [path] -exec 'cat {}\;' | grep ![term]

Currently can't get my laptop on wifi so wondering if that would work

2 points

This does indeed look suspicious if you are sure you did not try to run sudo echo test.

The PWD and the fact a password was tried make it seem like someone was logged in as your user and manually tried to execute this. (Obligatory: do you have any open fireplace or gas heater near you and no carbonmonoxide sensor? CO poisoning can lead to memory loss and other weird effects).

Try to check if anyone is logged in as your user with w or check open connections with ss.

This may be a broken service/software simply probing if it has root access for something harmless, but better safe than sorry, right? I would double check any AUR stuff related to youtube, it might not be the PKGBUILD but the source of the application itself that is infected.

4 points

If you find something suspicious. Do you do diligence, make sure everything has a password, your filewall is up, disable unused processes, change ssh port, require only ssh keys for logging in. The works

3 points

Changing your ssh port honestly doesn't really provide any extra protection. You'll always want to keep it lower than port 1024 to protect it from unprivileged processes on the local machine, which means remote attackers can use nmap to find the new port in under a second. Even if you throw caution to the wind and use a non-protected port, that'll only potentially delay them by a few more seconds. Disabling password auth and using sufficiently long keys is all you really need to do to secure ssh. Set up Fail2Ban if you get tired of skiddies cluttering up your logs with failed password login attempts.

2 points

My password is quite secure. >25 characters, uppercasee, lowercase, numbers, symbols, not dictionary words. I haven't told anyone my password so if this was something malicious it would be through something I installed.

1 points

You could check the cgroup tree of the bash running sudo (for example with systemd-cgls) this might get you a clue which service is responsible.

You also could freeze it (sending sigstop should be enough) and check for processes connected through pipes or sockets with the bash process (with lsof). You might also get the path to the script containing the call.

In the meantime until the call happens again you could check for files containing the string "echo test" with grep.

3 points

Maybe I could clone my system to another device (because I don't want to do tinkering with my system right now and I just want to use it as I normally do) and test it there?

2 points

You could try disconnecting from the internet, and looking to see if you get those messages while offline. Won't help much, but at least you could know if this is something local (program, ghost) and not joe hacker somewhere in control.

2 points

Well I killed the bash process and it hasn't returned. I would be curious to see if it comes back after I reboot.

2 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.