File: README

package info (click to toggle)
inetsim 1.3.1+dfsg.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,672 kB
  • sloc: perl: 13,059; sh: 267; makefile: 18; ansic: 13
file content (276 lines) | stat: -rw-r--r-- 10,479 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
----------------------------------------------------------------------
    This is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License , or
    (at your option) any later version.

    This software is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this software. If not, write to the Free Software
    Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
----------------------------------------------------------------------


1. DESCRIPTION
--------------

INetSim is a software suite for simulating common internet services
in a lab environment, e.g. for analyzing the network behaviour of
unknown malware samples.


1.1 Implemented service modules

Currently, modules for the simulation of the following services
are included with the INetSim distribution:

- HTTP/HTTPS
  - "real-mode": Delivers existing files from a webroot directory.
  - "fake-mode": Delivers configured fake files based on the file extension
                 in the HTTP request (e.g. .html or .exe) or static paths,
                 Requests for checkip.dyndns.org are answered with
                 client's IP address
  - supports HTTP methods GET, HEAD, POST and OPTIONS with HTTP/1.0 and HTTP/1.1
- SMTP/SMTPS
  - received e-mails are stored in mbox format
  - supports ESMTP and flexible configuration of service extensions
  - supports authentication methods PLAIN, LOGIN, ANONYMOUS, CRAM-MD5 and CRAM-SHA1
  - arbitrary authentication data is accepted and logged in plain text
- POP3/POP3S
  - dynamic creation of mailbox content from supplied mbox files
  - supports authentication methods PLAIN, LOGIN and CRAM-MD5
  - arbitrary authentication data is accepted and logged in plain text
- DNS
  - forward and reverse lookup with default and static configuration
- FTP/FTPS
  - download and upload
  - builds a virtual filesystem based on an existing ftproot directory
    which allows for creation and deletion of arbitrary files
- TFTP
  - download and upload
- IRC
  - basic command set
- NTP
- Ident
- Finger
- Syslog
- "Small servers":
  - Daytime,
  - Time,
  - Echo,
  - Chargen,
  - Discard and
  - Quotd
- Dummy

The listening port number can be configured for each service.


1.2 Faketime

INetSim can be run in 'faketime' mode to analyze the runtime behaviour
of malware which use NTP or Time/Daytime to start specific actions based
on the current date and time.

In 'faketime' mode, all services using date/time information (e.g. NTP or
HTTP) respond with a fake timestamp which is based on a configured delta
to current system time. Optionally, this delta can automatically be
incremented or decremented by a configured value at specific intervals.


1.3 Connection redirection

In addition to connection redirection via fake DNS responses, INetSim
allows for IP-based redirection of arbitrary connections (TCP, UDP and
ICMP). This feature is only available when running INetSim on Linux
platforms with Kernel support for packet queueing (Kernel compile time
option CONFIG_NETFILTER_NETLINK_QUEUE).

This feature supports static rules for connection redirection based on
target IP address, port and/or protocol. INetSim can also act as a
NAT router for redirection of packets to other hosts. Optionally,
the TTL value of IP packets sent to the clients from different "virtual"
connection targets can be varied to make traffic look more authentic.


1.4 Dummy service

The Dummy service simply logs all data received from the client.
This module is most useful when used along with connection redirection
to capture all traffic sent from the client to ports not bound to any
other service module.

Optionally, a configurable banner string can be sent if no data
has been received for a given amount of time after the client
established the connection. This might be useful e.g. while analyzing
a malware which expects a POP3 or SMTP server on an unusual port.


1.5 Logging and reports

All incoming requests to the simulated services and the corresponding
outgoing replies are logged in detail. When stopping an INetSim session,
optionally an additional report for that session with a summary of the
connections is created from the logfile.


2. AVAILABILITY
---------------

You can get the latest version of INetSim from <https://www.inetsim.org/>


3. PREREQUISITES
----------------

- POSIX compatible and System V IPC capable operating system (e.g. Linux)
- Perl version 5.006 or more recent
- Perl library Net::Server
  (available from http://search.cpan.org/~rhandom/Net-Server/)
- Perl library Net::DNS
  (available from http://search.cpan.org/~olaf/Net-DNS/)
- Perl library IPC::Shareable
  (available from http://search.cpan.org/~bsugars/IPC-Shareable/)
- Perl library Digest::SHA
  (available from http://search.cpan.org/~mshelor/Digest-SHA/)
- Perl library IO::Socket::SSL
  (available from http://search.cpan.org/~sullr/IO-Socket-SSL/)
- additionally, for IP-based connection redirection (only supported
  on Linux platforms with Kernel support for packet queueing):
  Perl library nfqueue
  (available from https://github.com/chifflier/nfqueue-bindings)

The current version of INetSim has been developed and tested on
Debian GNU/Linux 9 (stretch). It has been reported to also run
smoothly on different versions of Ubuntu, Gentoo Linux,
FreeBSD and OpenBSD.

If you successfully run INetSim on any other platform, or if you
experience problems running INetSim on platforms which meet the
above mentioned requirements, please drop us a note at
<inetsim at inetsim dot org>.


4. INSTALLATION
---------------

Get the latest version of INetSim from
<http://www.inetsim.org>.

Make sure you have installed Perl and all required modules
listed above.

INetSim runs all services with privileges of the user specified
in the configuration file (default: 'inetsim'), so make sure
this user exists on your system.
INetSim runs all services with privileges of group 'inetsim',
so you need to add a group with that name to your system.
On a Linux system, this can be done by executing the command
'groupadd inetsim' as root.

Unpack the downloaded tarball to a directory of your choice
(e.g. /opt/inetsim). Change into the top-level directory
of the unpacked tarball and run the script 'setup.sh' as root.
This will set some required permissions on files and
directories of INetSim.


5. CONFIGURATION
----------------

For a documentation of the configuration directives of INetSim,
please refer to the manpage 'inetsim.conf' in subdirectory
'man/man5' and the comments in the sample configuration file
'conf/inetsim.conf' included with the INetSim distribution.


6. USAGE
--------

To start INetSim, change into the top-level directory of the
unpacked tarball and run the startup script 'inetsim' as root.

For a documentation of the available command line options for the
startup script, please refer to the manpage 'inetsim' included
with the INetSim distribution in subdirectory 'man/man1'.

INetSim requires root privileges to bind sockets to ports below 1024.
After binding the sockets, root privileges are dropped as described
in section 'Installation'.
Currently, the INetSim startup script can only be run with root
privileges, even if no ports below 1024 are configured to be used.
This might change in future releases.

!! IMPORTANT NOTE for users of OpenBSD/FreeBSD: !!

The default maximum number of semaphore identifiers on OpenBSD/FreeBSD
is 10. INetSim needs some more semaphore identifiers to run. So you
have to raise the corresponding sysctl value (kern.seminfo.semmni on
OpenBSD, kern.ipc.semmni on FreeBSD). A value of 20 should work.
Otherwise INetSim will crash with an error message like
"Could not create semaphore set: No space left on device" on startup.


7.  ABOUT THE AUTHORS
---------------------

INetSim is developed by Thomas Hungenberg and Matthias Eckert.
We both work in the field of IT security and part of our daily work
is the analysis of unknown malware samples.


8.  ABOUT THE PROJECT
---------------------

To perform a quick run-time analysis of the network behaviour of
unknown malware samples, we were in need of a tool to simulate
internet services which are commonly used by malware in our
laboratory environment. We started off with a bunch of
home-grown Perl scripts together with specially configured
server service implementations like Apache, Postfix, dnsmasq and
ntpd, but we were not happy with this because of a lot of
disadvantages resulting from the combination of many programs
(e.g. problems with correlation of log data).

While talking to other security analysts, we noticed that there
is definitely a need for a comfortable single suite to simulate
different internet services with common logging and centralized
control functions. So we decided to start the project 'INetSim'
to develop such a suite.

Due to lack of time at the office, the programming was done in
our spare time. We both have been using Perl for many years but
mostly for small scripts, e.g. for the analysis of logfiles.
The project INetSim was a welcome opportunity to gain more
practical experience in programming Perl and to deal with the
specifications (RFCs) for several services in depth.

We think INetSim might be useful for other security researchers
as well and therefore decided to release it to the community as
free software licensed under the GNU General Public License (GPL).

Any feedback on your experiences with INetSim is appreciated.
Please send your comments to <inetsim at inetsim dot org>.

NOTE:
As this is our first larger software project written in Perl,
please do not be too harsh when you review the code.
By now, we learned a lot more about using references, packages
and object-oriented programming in Perl, so the design and code
will be much better in our next project. ;-) 


9. COPYRIGHT
------------

Copyright (c) 2007-2019 Thomas Hungenberg & Matthias Eckert

This software is licensed under the GNU General Public License (GPL).
For more information read the file COPYING which should be included
with this distribution.

----------------------------------------------------------------------