18

PLEASE NOTE: To view the comments on this and the extended discussion on this, which includes all that has been tried, please look at this chat room.


Today when I ran the cat command, instead of the contents of a file, I got:

Hello, nothing to see here! Move along!

I have checked to make sure that the cat file has not been changed after the last time I used it, so I am certain that the cat file in /bin has not been changed, so something else must be being run when I type in cat, instead of the proper cat program... But I don't see how that could have happened...

So I thought that I should ask here about it, so, why is this happening and how can I fix it?

Information Update:

I have checked in my .bash_aliases file, and there is no cat alias, nor one in my .bashrc file which points to the correct alias one.

The output of strings $(command -v cat) is:

#!/bin/bash
echo "Hello, nothing to see here! Move along!"

The output of type cat is:

cat is /bin/cat

The sha256sum of the file cat is:

a80c46f9c73190d6b46bdf444ade76d05ce113a21dbab7b805dde5027816aa48

The output of strace cat is:

execve("/bin/cat", ["cat"], [/* 61 vars */]) = 0
brk(0)                                  = 0x1833000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f0f0b44e000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=122452, ...}) = 0
mmap(NULL, 122452, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f0f0b430000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\v\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1869392, ...}) = 0
mmap(NULL, 3972864, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f0f0ae63000
mprotect(0x7f0f0b023000, 2097152, PROT_NONE) = 0
mmap(0x7f0f0b223000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c0000) = 0x7f0f0b223000
mmap(0x7f0f0b229000, 16128, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f0f0b229000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f0f0b42f000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f0f0b42e000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f0f0b42d000
arch_prctl(ARCH_SET_FS, 0x7f0f0b42e700) = 0
mprotect(0x7f0f0b223000, 16384, PROT_READ) = 0
mprotect(0x60b000, 4096, PROT_READ)     = 0
mprotect(0x7f0f0b450000, 4096, PROT_READ) = 0
munmap(0x7f0f0b430000, 122452)          = 0
brk(0)                                  = 0x1833000
brk(0x1854000)                          = 0x1854000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=5418528, ...}) = 0
mmap(NULL, 5418528, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f0f0a938000
close(3)                                = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 14), ...}) = 0
fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 14), ...}) = 0
fadvise64(0, 0, 0, POSIX_FADV_SEQUENTIAL) = 0
mmap(NULL, 139264, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f0f0b40b000
read(0,

Another thing which I have noticed is that this problem does not affect other users on the system.

echo $PATH outputs:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/neo/jdk1.8.0_45/bin

The output of printenv is:

XDG_VTNR=7
XDG_SESSION_ID=c2
CLUTTER_IM_MODULE=xim
XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/neo
SESSION=ubuntu
GPG_AGENT_INFO=/run/user/1000/keyring/gpg:0:1
TERM=xterm
SHELL=/bin/bash
VTE_VERSION=3803
WINDOWID=81788939
UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/1000/1640
GNOME_KEYRING_CONTROL=
GTK_MODULES=overlay-scrollbar:unity-gtk-module
USER=neo
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/neo/jdk1.8.0_45/bin
DESKTOP_SESSION=ubuntu
QT_IM_MODULE=ibus
QT_QPA_PLATFORMTHEME=appmenu-qt5
XDG_SESSION_TYPE=x11
JOB=unity-settings-daemon
PWD=/home/neo
XMODIFIERS=@im=ibus
GNOME_KEYRING_PID=
LANG=en_GB.UTF-8
GDM_LANG=en_GB
MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path
IM_CONFIG_PHASE=1
COMPIZ_CONFIG_PROFILE=ubuntu
JAVA_TOOL_OPTIONS=-javaagent:/usr/share/java/jayatanaag.jar 
GDMSESSION=ubuntu
SESSIONTYPE=gnome-session
XDG_SEAT=seat0
HOME=/home/neo
SHLVL=1
LANGUAGE=en_GB:en
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
UPSTART_INSTANCE=
UPSTART_EVENTS=xsession started
XDG_SESSION_DESKTOP=ubuntu
LOGNAME=neo
COMPIZ_BIN_PATH=/usr/bin/
QT4_IM_MODULE=xim
XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-9BqFSNNHkf
LESSOPEN=| /usr/bin/lesspipe %s
INSTANCE=
UPSTART_JOB=unity7
XDG_RUNTIME_DIR=/run/user/1000
DISPLAY=:0
XDG_CURRENT_DESKTOP=Unity
GTK_IM_MODULE=ibus
LESSCLOSE=/usr/bin/lesspipe %s %s
HISTTIMEFORMAT=%d/%m/%y %T 
XAUTHORITY=/home/neo/.Xauthority
_=/usr/bin/printenv

OS Information:

Description:    Ubuntu 15.04
Release:    15.04

Package Information:

coreutils:
  Installed: 8.23-3ubuntu1
  Candidate: 8.23-3ubuntu1
  Version table:
 *** 8.23-3ubuntu1 0
        500 http://gb.archive.ubuntu.com/ubuntu/ vivid/main amd64 Packages
        100 /var/lib/dpkg/status
5
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Mitch
    Jun 30, 2015 at 6:53
  • 2
    The cat binary command has clearly been replaced by a bash script (strings command)... so you probably have a "friend" who owns the root password?
    – Déjà vu
    Jul 2, 2015 at 8:58
  • @ring0: No, I am root on this machine, and only I know the password.
    – user364819
    Jul 2, 2015 at 16:41
  • 1
    If you run cat from another shell like dash, does it still show the weird output?
    – Léo Lam
    Jul 2, 2015 at 19:55
  • @LéoLam: Yes, to see what has already been answered, please look at this chat room with the extended chat.
    – user364819
    Jul 2, 2015 at 20:25

2 Answers 2

3

Well, so everything indicted in the chat session seems to indicate that your machine was hacked. Unfortunately we were unable to pinpoint the who, and most importantly, the how. Regardless, whoever did this seems to have become tired of the play and given up. After this, it was possible to solve the cat problem, with a sudo rm /usr/local/bin/cat2 (Attention, potentially dangerous command!)

You should now format your hard drive and reinstall Ubuntu from scratch. The problems you are facing in that front are, I think, content for another "Ask Ubuntu" question, where someone more knowledgeable than me will be able to help you.

Best of luck with your reinstall.

-1

I had to do a little research for this (including searching some source code to find out if it normally throws that message).

Cat is included in the coreutils package, so you might be able to run

sudo apt-get install --reinstall coreutils

This will reinstall coreutils (and cat).

Edit: removed second suggestion.

4
  • Removing coreutils will get rid of mv, cp, rm, pwd, ln, and mkdir, and will break many important scripts and make any shell practically unusable. I wouldn't even suggest the second method. Jul 4, 2015 at 1:13
  • The above is correct, and the more I think about it, apt probably uses some of those commands and would make it impossible to use apt to reinstall. Forgive my ignorance :)
    – steaksauce
    Jul 4, 2015 at 3:30
  • I tried reinstalling them, however this did not work (as in the reinstall was successful but cat still behaves the same).
    – user364819
    Jul 20, 2015 at 21:23
  • As this answer is incorrect and potentially dangerous please delete it with the delete button. This will also reverse the negative reputation you have got from any downvotes on this answer.
    – user364819
    Jan 2, 2016 at 12:38

You must log in to answer this question.