Skip to content

Commit 77f1121

Browse files
committed
Update MITM to CLI option based configuration
Instead of the old config file based mechanism
1 parent 447981a commit 77f1121

18 files changed

+541
-705
lines changed

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ npm-debug.log
1717
node_modules/*
1818

1919
# --------------------
20-
# MITM Config
20+
# MITM
2121
# --------------------
22-
# Ignore the real mitm.js files
23-
config/mitm*.js
24-
!config/mitm_example.js
22+
logs/

License.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
Copyright 2018 University of Maryland - College Park | Advanced Cybersecurity experience for Students
1+
Copyright 2018 University of Maryland - College Park | Advanced Cybersecurity Experience for Students
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
44

55
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
66

7-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 28 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
# Man-in-the-middle SSH Server
1+
# Man-in-the-Middle (MITM) SSH Server
22

33
## Objective
44

5-
Provide students the ability to collect SSH related data (login attempts, keystrokes) without the need for them to build their own SSH server.
6-
7-
See this [wiki page](https://github.com/UMD-ACES/MITM/wiki/Data-Collection) about the information collected by the MITM SSH server.
5+
Provide students with the ability to collect SSH related data (login attempts, keystrokes) without the need to build their own SSH server.
86

97
## Expectations
108

@@ -16,65 +14,50 @@ This program is not meant to facilitate the following:
1614
* Monitoring
1715
* Data Analysis
1816

19-
However, students may modify this program as they wish including faciliting the above while following the [rules](https://github.com/UMD-ACES/MITM/blob/master/README.md#rules) described at a later section.
17+
However, students may modify this program as they wish to add or change desired functionality.
18+
19+
# Data Collection
20+
This program will collect 3 main types of data:
21+
1. Authentication attempts - including client IP, username, and password
22+
2. Successful logins - client IP
23+
3. Session stream - raw session stream between the client & SSH server
24+
4. Session keystrokes - all the individual keystrokes and the parsed lines
2025

21-
## Resources
26+
## Start the MITM server
2227

23-
Please see the rest of this README page and check out the [wiki](https://github.com/UMD-ACES/MITM/wiki) pages.
28+
Run `node mitm.js -n <container name> -i <container internal IP> -p <MITM listening port>` to start the MITM server.
2429

30+
Run with the `--debug` flag for verbose debug output. This is helpful when first setting up the server.
2531

2632
## Configuration
2733

28-
| Setting | Type | Explanation |
29-
| :--------:| :----: | :------------|
30-
| local | Boolean | Runs the MITM SSH Server without requiring a container. Warning messages will display and there will be limitations (e.g. pty mode is disabled). |
31-
| debug | Boolean | MITM Debug Output. Good option to have enabled when building your honeypot ecosystem. Provides detailed logs of the actions that the MITM takes in real time. |
32-
| logToInstructor.enabled | Boolean | Logging the MITM operations into a DB (must be **enabled** unless otherwise stated by an instructor or TA) |
33-
| logging.streamOutput | String | Folder where the attacker streams are placed (keystrokes, screen display) |
34-
| logging.loginAttempts | String | Folder where all login attempts are being logged |
35-
| logging.logins | String | Folder where all logins are being logged |
36-
| server.maxAttemptsPerConnection | Integer | Number of login attempts before the server force closes on the SSH client |
37-
| server.listenIP | String | The IP address to listen on |
38-
| server.identifier | String | The SSH server identifier string sent to the SSH client |
39-
| server.banner | String | A message sent to clients upon connection to the MITM |
40-
| autoAccess.enabled | Boolean | If true, then enable automatic access to the honeypot after a certain number of login attempts (normal distribution using mean and standard deviation values). Can be manually set in the command line. |
41-
| autoAccess.cacheSize | Integer | Number of attacker IPs to hold when autoAccess is turned "on" . This value is required to not overwhelm the host memory. |
42-
| autoAccess.barrier.normalDist.enabled | Boolean | Enable normal distribution to calculate the login attempt threshold per attacker |
43-
| autoAccess.barrier.normalDist.mean | Integer | Mean number of login attempts before automatic access |
44-
| autoAccess.barrier.normalDist.standardDeviation | Integer | Standard Deviation. Automatic access follows a normal distribution. |
45-
| autoAccess.barrier.fixed.enabled | Boolean | Enable fixed login attempts threshold |
46-
| autoAccess.barrier.fixed.attempts | Number | Number of login attempts |
34+
Run with the `--help` option to see full list of configurable options and defaults.
4735

36+
## Automatic Access
4837

49-
## Start the MITM server
38+
This feature allows an attacker to successfully authenticate after a certain number of login attempts.
5039

51-
View this wiki page to learn about starting the MITM SSH Server (https://github.com/UMD-ACES/MITM/wiki/Spawn-a-MITM-SSH-Server-instance#launch-a-mitm-ssh-server)
40+
Auto-access will only be available for 1 automatic access per MITM process, meaning that once MITM is triggered once, it will be disabled.
5241

53-
## Running MITM in the background
42+
Furthermore, enabling auto-access will essentially disable authentication checks against the SSH server itself until auto-access strategy triggers.
5443

55-
Please check this [wiki page](https://github.com/UMD-ACES/MITM/wiki/Running-in-the-Background) if you would like to run the MITM in the background
44+
Enable auto-access by toggling the `--auto-access` option, then you must configure one of the two strategies available:
45+
1. normal distribution
46+
2. fixed attempt
5647

57-
## Automatic Access
48+
For normal distribution strategy, the server will allow auto-access after `--auto-access-normal-distribution-mean` number of attempts with the consideration of `--auto-access-normal-distribution-std-dev` to randomize the number of attempts required.
5849

59-
Allows an attacker to successfully authenticate after a certain number of login attempts.
50+
For fixed attempt strategy, the server will simply allow auto-access after --auto-access-fixed` number of attempts.
6051

61-
Before using automatic access, please read the following [wiki page](https://github.com/UMD-ACES/MITM/wiki/Automatic-Access)
52+
## Running MITM in the background
6253

63-
## Rules
64-
1. Do not add/edit/delete any code that are in the instructor blocks.
65-
2. You must enable the logToInstructor functionality.
66-
3. If you are having issues with a particular MITM instance, please make sure to communicate the session id
54+
Please check this [wiki page](https://github.com/UMD-ACES/MITM/wiki/Running-in-the-Background) if you would like to run the MITM in the background
6755

6856
## Stay up to date
69-
Run `git pull origin master` inside the /root/MITM directory.
70-
71-
## Documentation
72-
[Wiki Page](https://github.com/UMD-ACES/MITM/wiki)
57+
Run `git pull origin main` inside the /root/MITM directory.
7358

74-
## Authors
75-
Louis-Henri Merino
76-
Franz Payer
77-
Zhi Xiang Lin
59+
## Additional Documentation
60+
Some of the [Wiki Page](https://github.com/UMD-ACES/MITM/wiki) may be out of date, please review the information carefully.
7861

7962
## License
8063
MIT License

config/mitm_example.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

install.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env bash
22

3-
sudo apt-get update
3+
sudo apt update
44

5-
sudo apt-get install -y sudo build-essential curl php-cli gcc g++ make
5+
sudo apt install -y build-essential curl gcc g++ make
66

7-
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
7+
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
88

9-
sudo apt-get install -y nodejs
9+
sudo apt install -y nodejs
1010

1111
cd "$(dirname "$0")"
1212

lxc/add_user.php

Lines changed: 0 additions & 11 deletions
This file was deleted.

lxc/add_user.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
CONTAINER=$1
4+
USERNAME=$2
5+
6+
lxc-attach -n "$CONTAINER" -- useradd "$USERNAME" -m -s /bin/bash > /dev/null 2>&1 || true

lxc/ensure_mount.py

Lines changed: 0 additions & 44 deletions
This file was deleted.

lxc/execute_command.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

lxc/load_credentials.php

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)