Skip to content

Commit 6e6bc6f

Browse files
authored
Merge pull request #1055 from stratosphereips/develop
Slips v1.1.3
2 parents ab474d6 + e80c38a commit 6e6bc6f

File tree

83 files changed

+4639
-2502
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+4639
-2502
lines changed

.github/workflows/unit-tests.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ jobs:
4545
- tests/test_asn_info.py
4646
- tests/test_urlhaus.py
4747
- tests/test_markov_chain.py
48-
- tests/test_progress_bar.py
4948
- tests/test_daemon.py
5049
- tests/test_go_director.py
5150
- tests/test_notify.py
@@ -56,6 +55,15 @@ jobs:
5655
- tests/test_cesnet.py
5756
- tests/test_output.py
5857
- tests/test_riskiq.py
58+
- tests/test_spamhaus.py
59+
- tests/test_circllu.py
60+
- tests/test_evidence_handler.py
61+
- tests/test_alert_handler.py
62+
- tests/test_redis_manager.py
63+
- tests/test_ioc_handler.py
64+
- tests/test_timeline.py
65+
- tests/test_database.py
66+
- tests/test_symbols_handler.py
5967

6068
steps:
6169
- uses: actions/checkout@v4
@@ -89,10 +97,6 @@ jobs:
8997
- name: Start redis server
9098
run: redis-server --daemonize yes
9199

92-
- name: Run Database Unit Tests
93-
run: |
94-
python3 -m pytest tests/test_database.py -p no:warnings -vv
95-
96100
- name: Run Unit Tests for ${{ matrix.test_file }}
97101
run: |
98102
python3 -m pytest ${{ matrix.test_file }} -p no:warnings -vv -s -n 5

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
- 1.1.3 (October 30th, 2024)
2+
- Enhanced Slips shutdown process for smoother operations.
3+
- Optimized resource management in Slips, resolving issues with lingering threads in memory.
4+
- Remove the progress bar; Slips now provides regular statistical updates.
5+
- Improve unit testing—special thanks to @Sekhar-Kumar-Dash.
6+
- Drop support for macOS, P2P, and platform-specific Docker images. A unified Docker image is now available for all platforms.
7+
- Correct the number of evidence reported in statistics.
8+
- Fix incorrect end date reported in metadata/info.txt upon analysis completion.
9+
- Print more information to CLI on Slips startup, including network details, client IP, thresholds used, and more.
10+
- Reduce false positives from Spamhaus by looking up inbound traffic only.
11+
- Speed up horizontal port scan detections.
12+
- Enhance logging of IDMEF errors.
13+
- Resolve issues with the accumulated threat level reported in alerts.json.
14+
115
- 1.1.2 (September 30th, 2024)
216
- Add a relation between related evidence in alerts.json
317
- Better unit tests. Thanks to @Sekhar-Kumar-Dash

README.md

Lines changed: 8 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<h1 align="center">
2-
Slips v1.1.2
2+
Slips v1.1.3
33
</h1>
44

55

@@ -33,7 +33,6 @@ Slips v1.1.2
3333
- [GUI](#graphical-user-interface)
3434
- [Requirements](#requirements)
3535
- [Installation](#installation)
36-
- [Extended Usage](#extended-usage)
3736
- [Configuration](#configuration)
3837
- [Features](#features)
3938
- [Contributing](#contributing)
@@ -60,7 +59,7 @@ Slips is a powerful endpoint behavioral intrusion prevention and detection syste
6059
Slips is the first free software behavioral machine learning-based IDS/IPS for endpoints. It was created in 2012 by Sebastian Garcia at the Stratosphere Laboratory, AIC, FEE, Czech Technical University in Prague. The goal was to offer a local IDS/IPS that leverages machine learning to detect network attacks using behavioral analysis.
6160

6261

63-
Slips is supported on Linux and MacOS only. The blocking features of Slips are only supported on Linux
62+
Slips is supported on Linux, MacOS, and windows dockers only. The blocking features of Slips are only supported on Linux
6463

6564
Slips is Python-based and relies on [Zeek network analysis framework](https://zeek.org/get-zeek/) for capturing live traffic and analyzing PCAPs. and relies on
6665
Redis >= 7.0.4 for interprocess communication.
@@ -70,7 +69,7 @@ Redis >= 7.0.4 for interprocess communication.
7069

7170
The recommended way to use Slips is on Docker.
7271

73-
#### Linux
72+
#### Linux and Windows hosts
7473
```
7574
docker run --rm -it -p 55000:55000 --cpu-shares "700" --memory="8g" --memory-swap="8g" --net=host --cap-add=NET_ADMIN --name slips stratosphereips/slips:latest
7675
```
@@ -83,26 +82,11 @@ docker run --rm -it -p 55000:55000 --cpu-shares "700" --memory="8g" --memory-sw
8382
cat output_dir/alerts.log
8483
```
8584

86-
#### Macos M1
87-
In macos do not use --net=host if you want to access the internal container's ports from the host.
85+
#### Macos
86+
In MacOS, do not use --net=host if you want to access the internal container's ports from the host.
8887

8988
```
90-
docker run --rm -it -p 55000:55000 --cpu-shares "700" --memory="8g" --memory-swap="8g" --cap-add=NET_ADMIN --name slips stratosphereips/slips_macos_m1:latest
91-
```
92-
93-
```
94-
./slips.py -f dataset/test7-malicious.pcap -o output_dir
95-
```
96-
97-
```
98-
cat output_dir/alerts.log
99-
```
100-
101-
102-
#### Macos Intel
103-
104-
```
105-
docker run --rm -it -p 55000:55000 --cpu-shares "700" --memory="8g" --memory-swap="8g" --net=host --cap-add=NET_ADMIN --name slips stratosphereips/slips:latest
89+
docker run --rm -it -p 55000:55000 --platform linux/amd64 --cpu-shares "700" --memory="8g" --memory-swap="8g" --cap-add=NET_ADMIN --name slips stratosphereips/slips_macos_m1:latest
10690
```
10791

10892
```
@@ -160,7 +144,8 @@ Slips can be run on different platforms, the easiest and most recommended way if
160144

161145
* [Docker](https://stratospherelinuxips.readthedocs.io/en/develop/installation.html#slips-in-docker)
162146
* Dockerhub (recommended)
163-
* [Linux, MacOS and windows hosts](https://stratospherelinuxips.readthedocs.io/en/develop/installation.html#Running-Slips-from-DockerHub)
147+
* [Linux and windows hosts](https://stratospherelinuxips.readthedocs.io/en/develop/installation.html#linux-and-windows-hosts)
148+
* [MacOS hosts](https://stratospherelinuxips.readthedocs.io/en/develop/installation.html#macos-hosts)
164149
* [Docker-compose](https://stratospherelinuxips.readthedocs.io/en/develop/installation.html#running-slips-using-docker-compose)
165150
* [Dockerfile](https://stratospherelinuxips.readthedocs.io/en/develop/installation.html#building-slips-from-the-dockerfile)
166151
* Native
@@ -169,40 +154,8 @@ Slips can be run on different platforms, the easiest and most recommended way if
169154
* [on RPI (Beta)](https://stratospherelinuxips.readthedocs.io/en/develop/installation.html#installing-slips-on-a-raspberry-pi)
170155

171156

172-
173157
---
174158

175-
# Extended Usage
176-
177-
### Linux
178-
179-
##### [Analyse your own traffic without P2P](https://stratospherelinuxips.readthedocs.io/en/develop/installation.html#analyse-your-own-traffic)
180-
181-
182-
##### [Analyse your own traffic with P2P ](https://stratospherelinuxips.readthedocs.io/en/develop/installation.html#for-p2p-support-on-linux)
183-
184-
185-
##### [Analyse a pcap without using P2P](https://stratospherelinuxips.readthedocs.io/en/develop/installation.html#analyze-your-pcap-file)
186-
187-
188-
189-
### Macos M1
190-
191-
#### [Analyse your own traffic without using P2P](https://stratospherelinuxips.readthedocs.io/en/develop/installation.html#id1)
192-
193-
194-
### MacOS Intel processors
195-
196-
197-
##### [Analyse your own traffic without using P2P](https://stratospherelinuxips.readthedocs.io/en/develop/installation.html#id2)
198-
199-
200-
##### [Analyse your own traffic with using P2P](https://stratospherelinuxips.readthedocs.io/en/develop/installation.html#for-p2p-support-on-macos-intel)
201-
202-
203-
##### [Analyse a PCAP without using P2P](https://stratospherelinuxips.readthedocs.io/en/develop/installation.html#id2)
204-
205-
206159

207160
# Configuration
208161
Slips has a [config/slips.yaml](https://github.com/stratosphereips/StratosphereLinuxIPS/blob/develop/config/slips.yaml) that contains user configurations for different modules and general execution.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.2
1+
1.1.3

config/slips.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ parameters:
5454
# analysis_direction : all
5555
analysis_direction : out
5656

57-
5857
# Delete zeek log files after stopping slips.
58+
# this parameter deletes arp.log every 1h. useful for saving disk space
5959
delete_zeek_files : False
6060

6161
# Store a copy of zeek files in the output dir after the analysis is done.
@@ -140,7 +140,7 @@ parameters:
140140
# your own IP and is used to improve detections
141141
# it would be useful to specify it when analyzing pcaps or zeek logs
142142
# client_ips : [10.0.0.1, 172.16.0.9, 172.217.171.238]
143-
client_ips : "[]"
143+
client_ips : []
144144

145145
#############################
146146
detection:
@@ -172,9 +172,9 @@ detection:
172172
modules:
173173
# List of modules to ignore. By default we always ignore the template! do not remove it from the list
174174
# Names of other modules that you can disable (they all should be lowercase with no special characters):
175-
# threatintelligence, blocking,
176-
# networkdiscovery, timeline, virustotal, rnnccdetection, flowmldetection, updatemanager
177-
disable: "[template]"
175+
# threatintelligence, blocking, networkdiscovery, timeline, virustotal,
176+
# rnnccdetection, flowmldetection, updatemanager
177+
disable: [template]
178178

179179
# For each line in timeline file there is a timestamp.
180180
# By default the timestamp is seconds in unix time. However

docs/architecture.md

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ The architecture of Slips is basically:
44
- To receive some data as input
55
- To process it to a common format
66
- To enrich it (gather all possible info about the IPs/MAC/User-Agents etc.)
7-
- To apply detection modules
7+
- To apply detection modules
88
- To output results
99

1010
Slips is heavily based on the Zeek monitoring tool as input tool for packets from the interface and pcap file, due to its excelent recognition of protocols and easiness to identify the content of the traffic.
1111

12-
Figure 1 shows how the data is analyzed by Slips.
12+
Figure 1 shows how the data is analyzed by Slips.
1313
As we can see, Slips internally uses <a href="https://zeek.org/">Zeek</a>, an
1414
open source network security monitoring tool. Slips divides flows into profiles and
1515
each profile into a timewindows.
16-
Slips runs detection modules on each flow and stores all evidence,
17-
alerts and features in an appropriate profile structure.
16+
Slips runs detection modules on each flow and stores all evidence,
17+
alerts and features in an appropriate profile structure.
1818
All profile info, performed detections, profiles and timewindows' data,
19-
is stored inside a <a href="https://redis.io/">Redis</a> database.
19+
is stored inside a <a href="https://redis.io/">Redis</a> database.
2020
All flows are read, interpreted by Slips, labeled, and stored in the SQLite database in the output/ dir of each run
2121
The output of Slips is a folder with logs (output/ directory) that has alert.json, alerts.log, errors.log.
2222
Kalipso, a terminal graphical user interface. or the Web interface.
@@ -25,7 +25,7 @@ Kalipso, a terminal graphical user interface. or the Web interface.
2525
.zoom {
2626
transition: transform .2s; /* Animation */
2727
margin: 0;
28-
position: relative;
28+
position: relative;
2929
z-index:999;
3030
}
3131

@@ -42,7 +42,7 @@ Kalipso, a terminal graphical user interface. or the Web interface.
4242

4343

4444
Below is more explanation on internal representation of data, usage of Zeek and usage of Redis inside Slips.
45-
### Internal representation of data.
45+
### Internal representation of data.
4646

4747
Slips works at a flow level, instead of a packet level, gaining a high level view of behaviors. Slips creates traffic profiles for each IP that appears in the traffic. A profile contains the complete behavior of an IP address. Each profile is divided into time windows. Each time window is 1 hour long by default and contains dozens of features computed for all connections that start in that time window. Detections are done in each time window, allowing the profile to be marked as uninfected in the next time window.
4848

@@ -56,20 +56,20 @@ This is what slips stores for each IP/Profile it creates:
5656
* Used software - list of software used by this profile, for example SSH, Browser, etc.
5757
* MAC and MAC Vendor - Ether MAC of the IP and the name of the vendor
5858
* Host-name - the name of the IP
59-
* first User-agent - First UA seen use dby this profile.
59+
* first User-agent - First UA seen use dby this profile.
6060
* OS Type - Type of OS used by this profile as extracted from the user agent
6161
* OS Name - Name of OS used by this profile as extracted from the user agent
6262
* Browser - Name of the browser used by this profile as extracted from the user agent
63-
* User-agents history - history of the all user agents used by this profile
63+
* User-agents history - history of the all user agents used by this profile
6464
* DHCP - if the IP is a dhcp or not
65-
* Starttime - epoch formatted timestamp of when the profile first appeared
65+
* Starttime - epoch formatted timestamp of when the profile first appeared
6666
* Duration - the standard duration of every TW in this profile
6767
* Modules labels - the labels assigned to this profile by each module
6868
* Gateway - if the IP is the gateway (router) of the network
69-
* Timewindow count - Amount of timewindows in this profile
69+
* Timewindow count - Amount of timewindows in this profile
7070
* ASN - autonomous service number of the IP
7171
* Asnorg - name of the org that own the ASN of this IP
72-
* ASN Number
72+
* ASN Number
7373
* SNI - Server name indicator
7474
* Reverse DNS - name of the IP in reverse dns
7575
* Threat Intelligence - If the IP appeared in any of Slips blacklist
@@ -85,32 +85,32 @@ This is what slips stores for each IP/Profile it creates:
8585
* Url ratio: The higher the score the more malicious this IP is
8686

8787

88-
### Alerts vs Evidence
88+
### Alerts vs Evidence
8989

9090
When running Slips, the alerts you see in red in the CLI or at the very bottom in kalispo, are a bunch of evidence. Evidence in slips are detections caused by a specific IP in a specific timeframe. Slips doesn't alert on every evidence/detection. it accumulates evidence and only generates and alert when the amount of gathered evidence crosses a threshold. After this threshold Slips generates an alert, marks the timewindow as malicious(displays it in red in kalipso) and blocks the IP causing the alert.
91-
92-
### Usage of Zeek.
91+
92+
### Usage of Zeek.
9393

9494
Slips uses Zeek to generate files for most input types, and this data is used to create the profiles. For example, Slips uses this data to create a visual timeline of activities for each time window. This timeline consists of Zeek generated flows and additional interpretation from other logs like dns log and http log.
9595

9696

97-
### Usage of Redis database.
97+
### Usage of Redis database.
9898

9999
All the data inside Slips is stored in Redis, an in-memory data structure.
100100
Redis allows all the modules in Slips to access the data in parallel.
101101
Apart from read and write operations, Slips takes advantage of the Redis messaging system called Redis PUB/SUB.
102-
Processes may publish data into the channels, while others subscribe to these channels and process the new data when it is published.
102+
Processes may publish data into the channels, while others subscribe to these channels and process the new data when it is published.
103103

104-
### Usage of SQLite database.
104+
### Usage of SQLite database.
105105

106106
Slips uses SQLite database to store all flows in Slips interpreted format.
107107
The SQLite database is stored in the output/ dir and each flow is labeled to either 'malicious' or 'benign' based on slips detections.
108108
all the labeled flows in the SQLite database can be exported to tsv or json format.
109109

110110

111-
### Threat Levels
111+
### Threat Levels
112112

113-
Slips has 4 threat levels.
113+
Slips has 5 threat levels.
114114

115115
<style type="text/css">
116116
.tg {border-collapse:collapse;border-spacing:0;}
@@ -157,6 +157,17 @@ Slips has 4 threat levels.
157157
</tr>
158158

159159

160+
### How Slips Stops
161+
162+
- When slips is running on an interface or a growing zeek directory, slips keeps running forever until the user presses ctrl+c
163+
- When Slips is analyzing a PCAP or a zeek directory or any other supported file, It keeps running until no more flows are received.
164+
- After the modules receive that signal that says "no more new flows are coming", all modules keep processing the existing flows normally until they run out of msgs and stop.
165+
- Modules stop only if no more msgs are received in their Redis channels, and if they receive the signal that slips is no longer receiving new flows.
166+
- Slips knows that no more flows are arriving when it reaches the end of the given zeek/suricata/nfdump logs.
167+
- If some processes are hanging in memory, slips wait by default 1 week before killing them. This can be modified in the config.yaml.
168+
169+
For more techincal details about this check https://stratospherelinuxips.readthedocs.io/en/develop/contributing.html#faq
170+
160171

161172
</tbody>
162-
</table>
173+
</table>

docs/code_documentation.md

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,3 @@
11
# Code documentation
22

3-
### How Slips Works
4-
5-
<img src="https://raw.githubusercontent.com/stratosphereips/StratosphereLinuxIPS/develop/docs/images/slips_workflow.png" title="Slips Workflow">
6-
7-
1. slips.py is the entry point, it's responsible for starting all modules, and keeping slips up until the analysis is finished.
8-
2. slips.py starts the input process, which is the one responsible for reading the flows from the files given to slips using -f
9-
it detects the type of file, reads it and passes the flows to the profiler process. if slips was given a PCAP or is running on an interface
10-
, the input process starts a zeek thread that analyzes the pcap/interface using slips' own zeek configuration and sends the generated zeek
11-
flows to the profiler process.
12-
3. slips.py also starts the update manager, it updates slips local TI files, like the ones stored in slips_files/organizations_info and slips_files/ports_info.
13-
later, when slips is starting all the modules, slips also starts the update manager but to update remote TI files in the background in this case.
14-
4. Once the profiler process receives the flows read by the input process, it starts to convert them to a structure that slips can deal with.
15-
it creates profiles and time windows for each IP it encounters.
16-
5. Profiler process gives each flow to the appropriate module to deal with it. for example flows from http.log will be sent to http_analyzer.py
17-
to analyze them.
18-
6. Profiler process stores the flows, profiles, etc. in slips databases for later processing. the info stored in the dbs will be used by all modules later.
19-
Slips has 2 databases, Redis and SQLite. it uses the sqlite db to store all the flows read and labeled. and uses redis for all other operations. the sqlite db is
20-
created in the output directory, meanwhite the redis database is in-memory.
21-
7-8. using the flows stored in the db in step 6 and with the help of the timeline module, slips puts the given flows in a human-readable form which is
22-
then used by the web UI and kalipso UI.
23-
9. when a module finds a detection, it sends the detection to the evidence process to deal with it (step 10) but first, this evidence is checked by the whitelist to see if it's
24-
whitelisted in our config/whitelist.conf or not. if the evidence is whitelisted, it will be discarded and won't go through the next steps
25-
10. now that we're sure that the evidence isn't whitelisted, the evidence process logs it to slips log files and gives the evidence to all modules responsible for exporting
26-
evidence. so, if CEST, Exporting modules, or CYST is enabled, the evidence process notifies them
27-
through redis channels that it found an evidence and it's time to share the evidence.
28-
11. if the blocking module is enabled using -p, the evidence process shares all detected alerts to the blocking module. and the blocking module handles
29-
the blocking of the attacker IP through the linux firewall (supported in linux only)
30-
12. if p2p is enabled in config/slips.yaml, the p2p module shares the IP of the attacker, its' score and blocking requests sent by the evidence process
31-
with other peers in the network so they can block the attackers before they reach them.
32-
13. The output process is slips custom logging framework. all alerts, warnings and info printed are sent here first for proper formatting and printing.
33-
34-
This is a brief explanation of how slips works for new contributors.
35-
36-
All modules described above are talked about in more detail in the rest of the documentation.
37-
38-
39-
### Code Docs
40-
41-
[Slips auto-generated code documentation here](https://stratosphereips.github.io/StratosphereLinuxIPS/files.html)
3+
[Slips auto-generated code documentation](https://stratosphereips.github.io/StratosphereLinuxIPS/files.html)

0 commit comments

Comments
 (0)