Skip to content

Commit b428ce4

Browse files
committed
Finally commit May 2024 version. Fix #11
1 parent 1ad85fd commit b428ce4

30 files changed

+382
-167
lines changed

LEEME.txt

+7-4
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,14 @@ Y las siguientes dependencias:
116116
unhide-linux, unhide-posix, unhide_rb :
117117
procps
118118

119+
IMPORTANTE : Tenga en cuenta que, como herramienta forense, unhide se construye estáticamente ya que las librerías del sistema anfitrión pueden estar
120+
comprometidas y para evitar ser engañado por una configuración PRELINKing.
121+
119122
Si estás usando un kernel de Linux > = 2.6
120-
gcc -Wall -O2 --static -pthread unhide-linux*.c unhide-output.c -o unhide-linux
121-
gcc -Wall -O2 --static unhide_rb.c -o unhide_rb
122-
gcc -Wall -O2 --static unhide-tcp.c unhide-tcp-fast.c unhide-output.c -o unhide-tcp
123-
ln -s unhide unhide-linux
123+
gcc -Wall -Wextra -O2 --static -pthread unhide-linux*.c unhide-output.c -o unhide-linux
124+
gcc -Wall -Wextra -O2 --static unhide-tcp.c unhide-tcp-fast.c unhide-output.c -o unhide-tcp
125+
gcc -Wall -Wextra -O2 --static unhide_rb.c -o unhide_rb
126+
ln -s unhide unhide-linux
124127

125128
Si no,(Linux < 2.6, *BSD, Solaris and other Unix)
126129
gcc --static unhide-posix.c -o unhide-posix

LISEZ-MOI.TXT

+6-4
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,14 @@ unhide-linux, unhide-posix, unhide_rb :
130130
procps
131131

132132

133+
IMPORTANT : Il convient de noter qu'en tant qu'outil de police scientifique, unhide est construit de manière statique, car les bibliothèques du système hôte
134+
peuvent être compromises ainsi que pour éviter d'être trompé par un paramètre PRELINKing.
133135

134136
Si vous utilisez un noyau Linux >= 2.6
135-
gcc -Wall -O2 --static -pthread unhide-linux*.c unhide-output.c -o unhide-linux
136-
gcc -Wall -O2 --static unhide_rb.c -o unhide_rb
137-
gcc -Wall -O2 --static unhide-tcp.c unhide-tcp-fast.c unhide-output.c -o unhide-tcp
138-
ln -s unhide unhide-linux
137+
gcc -Wall -Wextra -O2 --static -pthread unhide-linux*.c unhide-output.c -o unhide-linux
138+
gcc -Wall -Wextra -O2 --static unhide-tcp.c unhide-tcp-fast.c unhide-output.c -o unhide-tcp
139+
gcc -Wall -Wextra -O2 --static unhide_rb.c -o unhide_rb
140+
ln -s unhide unhide-linux
139141

140142
Sinon (Linux < 2.6, *BSD, Solaris, etc.)
141143
gcc --static unhide-posix.c -o unhide-posix

NEWS

+38-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,45 @@ Changes since v20220611 :
33

44
BUG FIXES
55
- Add missing missing double quotes in __credit__ list of unhideGui.py (reported by Afzal sulaiman)
6+
- Fix parsing of the outpout of "ps --no-header -eL o lwp,cmd" (REVERSE test) which might cause false positives
7+
in some very rare cases if line length is greater than 1023. (reported by @basak from Ubuntu). Replace fgets() with getline()
8+
- Fix the same type of error in reading "/proc/PID/cmdline" in hidden process reporting where the displayed cmd line was truncated if longer than 1000.
9+
- Fix return checking of atol() function. (reported by @basak from Ubuntu).
10+
- Fix lenght of LWP string to accept 32 bit PID. This bug is triggered for PID > 999999 only and has no visible effect before replacing fgets() by getline().
11+
12+
Wextra WARNINGS REMOVAL
13+
- Add option -Wextra to build instruction.
14+
- Remove "unused parameter" warning in unhide-linux-bruteforce.c:void *functionThread()
15+
- Make table pointers global to remove "variable ‘xxx’ might be clobbered by ‘longjmp’ or ‘vfork’" warning.
16+
- Use precision specifier in sprintf to avoid useless format-overflow warning
17+
- Also build with clang without warnings
618

19+
ENHANCEMENTS
20+
- Add the invalid argument text to "Unknown Argument" message.
21+
- Add some tests for last fixes.
22+
- Add a few clarifications to the test descriptions
23+
- Clarify some output messsages.
24+
25+
TEST/STATIC ANALYSIS
26+
- use of scanbuild with gcc and clang gives 22 warnings:
27+
- 2 warnings concerning the use of vfork() : unsafe, possible DDOS --> can't fix: using vfork is the aim of the test :)
28+
- 20 warnings about unused initialization value of variables -> won't fix: in my rules all variables are explicitly initialized :)
729

30+
GUI
31+
- Fix a search error in management of group of test commands (threw an exception in a Tkinter event routine, but finally worked as expected by following a convoluted path).
32+
- Search for unhide and unhide-tcp paths instead of use '.' (cwd) : prefered path ./, default path /usr/sbin/
33+
- Add comment under shebang with alternative path as not all distrib softlink /bin to /usr/bin.
34+
- Remove some debug print statement.
35+
36+
HELP FILES
37+
- Add "missing" \ (escape) to option dashes. It makes no difference when groff version < 1.23 but it does after (it seems Debian has reverted this change in its version of
38+
groff as it breaks thousands of Linux man pages).
39+
40+
MISCELLANEOUS
41+
- Add in its displayed header that unhide_rb is unmaintained.
42+
- Update version and copyright dates.
43+
44+
845
Changes since 20210124 :
946
**********************
1047

@@ -23,7 +60,7 @@ GUI
2360

2461
MISCELLANOUS
2562
- Update README.txt (build instructions and some document layout)
26-
- Clearly indicate in its display header of unhide_rb that it SHOULD NOT be used for serious work.
63+
- Clearly indicate in its display header that unhide_rb MUST NOT be used for serious work.
2764
- Change links in man pages from SourceForge to GitHub, update e-mails addresses, correct some formatting errors
2865
- Complete contributors list in README/LEEME/LISEZ-MOI
2966

README.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ man/fr/unhide-tcp.8 -- French man page of unhide-tcp
118118
procps
119119

120120

121-
IMPORTANT : Notes that, as a forensic tool, unhide is built statically as the host system libraries may be compromised.
121+
IMPORTANT : Notes that, as a forensic tool, unhide is built statically as the host system libraries may be compromised and to avoid being fooled by a PRELINKing.
122122

123123
If you ARE using a Linux kernel >= 2.6
124124
gcc -Wall -Wextra -O2 --static -pthread unhide-linux*.c unhide-output.c -o unhide-linux

TODO

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
[TODO]
2+
- For Brute force test: add an option to choose the number of checks to do. With the increase of the max process number, duration of brute test becomes very long.
3+
So (very) short live processes, appearing and disappearing during the brute test, start to give some false positives even with double check.
4+
At least make double check the default.
5+
The more the number of runs the less the number of false positives.
26
- Integrate -m in other test,
37
- Try to factorize the code,
48
- More optimizations,

changelog

+54
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,57 @@
1+
2024-05
2+
3+
README.txt, LISEZMOI.txt and LEEME.txt
4+
- Add option -Wextra to build instruction.
5+
6+
unhide.8, unhide-tcp.8, fr/unhide.8, fr/unhide-tcp.8, es/unhide.8, es/unhide-tcp.8
7+
- add mising escpe of dash char. They're needed for recent version of Groff-man macros as they are no more automacically escaped.
8+
- update reference date of man pages.
9+
10+
sanity.sh
11+
- Add new tests for testing new fixes.
12+
- minors typo corrections of output texts and comments
13+
- update © date.
14+
15+
unhide-linux-bruteforce.c
16+
- Add "__attribute__ ((unused))" to functionThread (void *parametro) in order to suppress -Wextra warning.
17+
- Transform allpids and allpids2 variables from brute() function to globals to suppress -Wextra warning (using volatile doesn't work in this case).
18+
19+
unhide-linux-compound.c
20+
- Replace use of fgets() by call to getline() in order to be able to parse process cmdline of more than 1024 char with digit at 1024th position. (reported by @basak from Ubuntu packaging team).
21+
- Fix a buffer overflow detected thanks to the above modification. Previously, the overflow only overwrites stack data which are no more used. It happened only when a process has a PID > 999999.
22+
- Fix error checking of atol().
23+
- Add a check to see if the PID is a numerical value, else display a warning (if verbose mode)
24+
- Clarify some warning messages.
25+
- Increase LWP string in checkallreverse() to accept 32bits PID (20 bits previously)
26+
27+
unhide-linux-procfs.c
28+
- Add precision (max legth) to %s in format strings to suppress -Wextra warning.
29+
- Remove "pragma GCC diagnostic ignored "-Wformat-overflow"
30+
31+
unhide-linux.c
32+
- Update Copyright notice and version header.
33+
- Replace use of fgets() by call to getline() in printbadpid(): display of cmdline could be truncated if their length was > 1023.
34+
- Double the size of the buffer used with readlink(): 2000 char, hoping it's enough for all paths :). if not readlink truncates the path to 2000 char.
35+
- Clarify some messages.
36+
- In case of unknown arg on command line, indicate which one it is in error message.
37+
38+
unhide-posix.c
39+
- Update Copyright notice and version header.
40+
41+
unhide-tcp.c
42+
- Update Copyright notice and version header.
43+
44+
unhideGui.py
45+
- Add a comment with alternative shebang as some distrib don't soft link /bin to /usr/bin.
46+
- Fix search of single test in test group (generate a tkinter exeption, but work anyway).
47+
- Search path of unhide-linux / unhide-tcp executables instead of forcing "./" as path.
48+
49+
unhide_rb.c
50+
- Update Copyright notice and version header.
51+
- Fix some typo in displayed header.
52+
- Indicate unhibe_rb is no more maintained and must not be used for serious work.
53+
54+
155
2021-01
256
unhide-linux-procfs.c
357
- Suppress -Wformat-overflow warning by GCC >= 8.0 in function checkreaddir().

man/es/unhide-tcp.8

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH "UNHIDE-TCP" "8" "Junio 2022" "Administration commands" ""
1+
.TH "UNHIDE-TCP" "8" "Maio 2022" "Administration commands" ""
22
.SH "NOMBRE"
33
unhide\-tcp \(em Herramienta forense para localizar puertos TCP/UDP ocultos
44
.SH "SYNOPSIS"

man/es/unhide.8

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH "UNHIDE" "8" "Junio 2022" "Comandos de administración" ""
1+
.TH "UNHIDE" "8" "Maio 2024" "Comandos de administración" ""
22
.SH "NOMBRE"
33
unhide \(em Herramienta forense para descubrir procesos ocultos
44
.SH "SINOPSIS"

man/fr/unhide-tcp.8

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH "UNHIDE-TCP" "8" "Juin 2022" "Commandes d'administration"
1+
.TH "UNHIDE-TCP" "8" "Mai 2024" "Commandes d'administration"
22
.SH "NOM"
33
unhide-tcp \(em outil d'investigation post-mortem pour trouver des ports TCP/UDP cachés
44
.SH "SYNOPSIS"
@@ -13,40 +13,40 @@ tous les ports TCP/UDP existants.
1313
.br
1414
Note1 : sur FreeBSD et OPENBSD, netstat est systématiquement utilisé iproute2 n'existant pas
1515
sur ces systèmes. De plus sur FreeBSD, sockstat est utilisé à la place de fuser.
16-
Note2 : si iproute2 n'est pas installé sur le système, une des option -n ou - s
16+
Note2 : si iproute2 n'est pas installé sur le système, une des option \-n ou \-s
1717
DOIT être utilisée sur la ligne de commande.
1818
.PP
1919
.SH "OPTIONS"
2020
.TP
2121
\fB\-h\fR
2222
Affiche l'aide.
2323
.TP
24-
\fB\--brief\fR
24+
\fB\\-\-brief\fR
2525
N'affiche pas les messages d'avertissement, c'est le comportement par défaut.
2626
.TP
27-
\fB\-f --fuser\fR
27+
\fB\-f \-\-fuser\fR
2828
Affiche la sortie de fuser (si elle est disponible) pour les ports cachés.
2929
Sur FreeBSD, affiche, à la place, la sortie de sockstat pour les ports cachés.
3030
.TP
31-
\fB\-l --lsof\fR
31+
\fB\-l \-\-lsof\fR
3232
Affiche la sortie de lsof (si elle est disponible) pour les ports cachés.
3333
.TP
34-
\fB\-n --netstat\fR
34+
\fB\-n \-\-netstat\fR
3535
Utilise /bin/netstat au lieu de /sbin/ss. Sur les systèmes où un grand nombre de ports sont ouverts,
3636
cela peut ralentir le test de façon dramatique.
3737
.TP
38-
\fB\-o --log\fR
38+
\fB\-o \-\-log\fR
3939
Enregistre les sorties dans un fichier de log (unhide-tcp-AAAA-MM-JJ.log) situé dans le répertoire courant.
4040
.TP
41-
\fB\-s --server\fR
41+
\fB\-s \-\-server\fR
4242
Utilise une stratégie d'analyse très rapide. Sur un système avec un très grand nombre de ports ouverts,
4343
c'est des centaines de fois plus rapide que la méthode ss et des dizaines de milliers de fois plus rapide que
4444
la méthode netstat.
4545
.TP
46-
\fB\-V --version\fR
46+
\fB\-V \-\-version\fR
4747
Affiche la version et sort
4848
.TP
49-
\fB\-v --verbose\fR
49+
\fB\-v \-\-verbose\fR
5050
Affichage prolixe, affiche les message d'avertissement (par défaut : ne pas afficher).
5151
.PP
5252
.SS "Exit status:"

man/fr/unhide.8

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH "unhide" "8" "Juin 2022" "Commandes d'administration"
1+
.TH "unhide" "8" "Mai 2024" "Commandes d'administration"
22
.SH "NOM"
33
unhide \(em outil d'investigation post\-mortem pour trouver des processus cachés
44
.SH "SYNOPSIS"
@@ -16,28 +16,28 @@ détecte les processus cachés en utilisant six techniques principales.
1616
.PP
1717
Les options sont uniquement disponibles pour \fBunhide-linux\fR pas pour \fBunhide-posix\fR.
1818
.TP
19-
\fB \-d\fR
19+
\fB\-d\fR
2020
Effectue un double contrôle dans le test 'brute' pour diminuer l'occurence des faux positifs.
2121
.TP
22-
\fB \-f\fR
22+
\fB\-f\fR
2323
Enregistre les sorties dans un fichier de log (unhide-linux.log) situé dans le répertoire courant.
2424
.TP
25-
\fB \-h\fR
25+
\fB\-h\fR
2626
Affichage de l'aide.
2727
.TP
28-
\fB \-m\fR
28+
\fB\-m\fR
2929
Exécute des contrôles supplémentaires. Pour la version 2012\-03\-17, cette option n'a
3030
d''effet pour les tests procfs, procall, checkopendir et checkchdir.
3131
.br
3232
Elle implique l'option \-v.
3333
.TP
34-
\fB \-r\fR
34+
\fB\-r\fR
3535
Utilise une version alternative du test sysinfo lors du lancement d'un test standard.
3636
.TP
37-
\fB \-V\fR
37+
\fB\-V\fR
3838
Affiche la version et sort.
3939
.TP
40-
\fB \-v\fR
40+
\fB\-v\fR
4141
Affichage prolixe, affiche les message d'avertissement (par défaut : ne pas afficher).
4242
Cette option peut être répétée plus d'une fois.
4343
.TP
@@ -86,7 +86,7 @@ Cette technique n'est disponible qu'avec la version unhide\-linux.
8686
.PP
8787
La technique \fIreverse\fR consiste à vérifier que tous les threads vus par /bin/ps
8888
sont également vus dans le procfs et par les appels système. C'est une recherche
89-
inversée. Elle est destiné à vérifier qu'un rootkit n'a pas tué un outil de sécurité
89+
inversée. Elle est destiné à vérifier qu'un rootkit n'a pas tué un outil de sécurité
9090
(IDS ou autre) et modifié /bin/ps pour lui faire afficher un faux processus à la place.
9191
.br
9292
Cette technique n'est disponible qu'avec la version unhide\-linux.
@@ -222,7 +222,7 @@ Test standard :
222222
unhide sys proc
223223
.TP
224224
Test le plus complet :
225-
unhide -m -d sys procall brute reverse
225+
unhide \-m \-d sys procall brute reverse
226226
.SH "BUGS"
227227
.PP
228228
Rapportez les bugs de \fBunhide\fR sur le bug tracker de GitHub (https://github.com/YJesus/Unhide/issues)

man/unhide-tcp.8

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH "UNHIDE-TCP" "8" "June 2022" "Administration commands"
1+
.TH "UNHIDE-TCP" "8" "May 2024" "Administration commands"
22
.SH "NAME"
33
unhide-tcp \(em forensic tool to find hidden TCP/UDP ports
44
.SH "SYNOPSIS"
@@ -13,40 +13,40 @@ TCP/UDP ports available.
1313
.br
1414
Note1 : On FreeBSD ans OpenBSD, netstat is always used as iproute2 doesn't exist
1515
on these OS. In addition, on FreeBSD, sockstat is used instead of fuser.
16-
Note2 : If iproute2 is not available on the system, option -n or -s SHOULD be
16+
Note2 : If iproute2 is not available on the system, option \-n or \-s SHOULD be
1717
given on the command line.
1818
.PP
1919
.SH "OPTIONS"
2020
.TP
21-
\fB\-h --help\fR
21+
\fB\-h \-\-help\fR
2222
Display help
2323
.TP
24-
\fB\--brief\fR
24+
\fB\-\-brief\fR
2525
Don't display warning messages, that's the default behavior.
2626
.TP
27-
\fB\-f --fuser\fR
27+
\fB\-f \-\-fuser\fR
2828
Display fuser output (if available) for the hidden port
2929
On FreeBSD, instead of fuser command, displays the output of the sockstat command for the hidden port.
3030
.TP
31-
\fB\-l --lsof\fR
31+
\fB\-l \-\-lsof\fR
3232
Display lsof output (if available) for the hidden port
3333
.TP
34-
\fB\-n --netstat\fR
34+
\fB\-n \-\-netstat\fR
3535
Use /bin/netstat instead of /sbin/ss. On system with many opened ports, this can
3636
slow down the test dramatically.
3737
.TP
38-
\fB\-s --server\fR
38+
\fB\-s \-\-server\fR
3939
Use a very quick strategy of scanning. On system with a lot of opened ports,
4040
it is hundreds times faster than ss method and ten thousands times faster than
4141
netstat method.
4242
.TP
43-
\fB\-o --log\fR
43+
\fB\-o \-\-log\fR
4444
Write a log file (unhide-tcp-AAAA-MM-DD.log) in the current directory.
4545
.TP
46-
\fB\-V --version\fR
46+
\fB\-V \-\-version\fR
4747
Show version and exit
4848
.TP
49-
\fB\-v --verbose\fR
49+
\fB\-v \-\-verbose\fR
5050
Be verbose, display warning message (default : don't display).
5151
This option may be repeated more than once.
5252
.PP

man/unhide.8

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH "UNHIDE" "8" "June 2022" "Administration commands"
1+
.TH "UNHIDE" "8" "May 2024" "Administration commands"
22
.SH "NAME"
33
unhide \(em forensic tool to find hidden processes
44
.SH "SYNOPSIS"
@@ -29,7 +29,7 @@ Display help
2929
Do more checks. As of 2012\-03\-17 version, this option has only
3030
effect for the procfs, procall, checkopendir and checkchdir tests.
3131
.br
32-
Implies -v
32+
Implies \-v
3333
.TP
3434
\fB\-r\fR
3535
Use alternate version of sysinfo check in standard tests
@@ -73,7 +73,7 @@ This technique is only available with version unhide\-linux.
7373
The \fIprocfs\fR technique consists of comparing information
7474
gathered from /bin/ps with information gathered by walking in the procfs.
7575
.br
76-
With \fB-m\fR option, this test makes more checks, see \fIcheckchdir\fR test.
76+
With \fB\-m\fR option, this test makes more checks, see \fIcheckchdir\fR test.
7777
.br
7878
This technique is only available with version unhide\-linux.
7979
.PP
@@ -103,7 +103,7 @@ This technique is only available with version unhide\-linux.
103103
The \fIcheckchdir\fR technique consists of comparing information
104104
gathered from /bin/ps with information gathered by making chdir() in the procfs.
105105
.br
106-
With the \fB-m\fR option, it also verify that the thread appears in its
106+
With the \fB\-m\fR option, it also verify that the thread appears in its
107107
"leader process" threads list.
108108
.br
109109
This technique is only available with version unhide\-linux.
@@ -224,7 +224,7 @@ Standard test:
224224
unhide sys proc
225225
.TP
226226
Deeper test:
227-
unhide -m -d sys procall brute reverse
227+
unhide \-m \-d sys procall brute reverse
228228
.SH "BUGS"
229229
.PP
230230
Report \fBunhide\fR bugs on the bug tracker on GitHub (https://github.com/YJesus/Unhide/issues)

0 commit comments

Comments
 (0)