19 Commits

Author SHA1 Message Date
Sebastian Lenzlinger
6d88d1e97d Update keylogger_detector.py
Fix Tabs in help messages
2023-06-13 11:48:42 +02:00
Sebastian Lenzlinger
522fb0a847 Add QR Code to repository. 2023-06-13 11:39:09 +02:00
Sebastian Lenzlinger
72bbf7a575 Stop Kernel Detector from allways running and crashing the system 2023-06-13 11:38:35 +02:00
Sebastian Lenzlinger
92fc49ac9e FIX 2023-06-11 18:24:42 +02:00
Sebastian Lenzlinger
c8da5e4743 DEBUG 2023-06-11 18:12:26 +02:00
Sebastian Lenzlinger
0e2250816e DEBUG 2023-06-11 18:08:56 +02:00
Sebastian Lenzlinger
1ffe505c5d DEBUG 2023-06-11 17:40:06 +02:00
Sebastian Lenzlinger
0f1b6d4543 DEBUG 2023-06-11 17:39:06 +02:00
Sebastian Lenzlinger
1a0ae39e87 DEBUG 2023-06-11 17:36:17 +02:00
Sebastian Lenzlinger
8ce2a8c55c DEBUG 2023-06-11 16:46:55 +02:00
Sebastian Lenzlinger
037963bccb DEBUG 2023-06-11 16:45:57 +02:00
Sebastian Lenzlinger
d2ab6c92a8 Quick DEBUG 2023-06-11 16:41:32 +02:00
Sebastian Lenzlinger
b4005d7876 Small Bug Fix 2023-06-11 15:33:22 +02:00
Sebastian Lenzlinger
6f13ce5d89 Integrate kernel detector in to main program. Add option to run kernel detector 2023-06-11 15:31:49 +02:00
Sebastian Lenzlinger
626915fd70 Merge pull request #6 from sebaschi/sebaschi-patch-1
Update kernel_detector.py
2023-06-11 15:25:41 +02:00
Sebastian Lenzlinger
bb607848dc Update kernel_detector.py
remove exit() from within run_kernel_detection()
2023-06-11 15:25:31 +02:00
Sebastian Lenzlinger
0198c6d0fa Delete funcall_trace2.stp 2023-06-11 15:24:39 +02:00
Sebastian Lenzlinger
c67c88b750 Delete funcall_trace1.stp 2023-06-11 15:24:31 +02:00
Sebastian Lenzlinger
e210227b31 Merge pull request #5 from sebaschi/SoulKindred-patch-1
Kernel Detector
2023-06-11 15:23:23 +02:00
10 changed files with 109 additions and 103 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View File

@@ -0,0 +1,17 @@
@inproceedings{10.1145/2390317.2390326,
author = {Howard, Adam and Hu, Yi},
title = {An Approach for Detecting Malicious Keyloggers},
year = {2012},
isbn = {9781450315388},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/2390317.2390326},
doi = {10.1145/2390317.2390326},
abstract = {Keyloggers are applications that are installed onto computers with the intent of monitoring and storing keystrokes that are input by a user. These keystrokes can either be stored on a physical hard disk or transmitted via a network connection to a remote location. Because of their functions, keyloggers have a potential of being used for malicious purposes. In order to protect privacy, it is important to realize the threat that a keylogger application might pose and identify appropriate methods for detecting it. The method presented in this research provides a standardized approach to detect unknown keylogging software from a computer. We also conducted experiments on a variety of keyloggers to verify the effectiveness of the proposed approach.},
booktitle = {Proceedings of the 2012 Information Security Curriculum Development Conference},
pages = {5356},
numpages = {4},
keywords = {rootkit, privacy, system hook, keylogger, malicious software},
location = {Kennesaw, Georgia},
series = {InfoSecCD '12}
}

View File

@@ -0,0 +1,17 @@
@inproceedings{10.1145/2905055.2905362,
author = {Amin, Maitri},
title = {A Survey of Financial Losses Due to Malware},
year = {2016},
isbn = {9781450339629},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/2905055.2905362},
doi = {10.1145/2905055.2905362},
abstract = {General survey stat that the main damage malware can cause is to slow down their PCs and perhaps crash some websites which is quite wrong, The Russian antivirus software developer teamed up with B2B International for a study worldwide recently, shown 36\% of users lose money online as a result of a malware attack. Currently malware can't be detected by traditional way based anti-malware tools due to their polymorphic and/or metamorphic nature. Here we have improvised a current detection technique of malware based on mining Application Programming Interface (API) calls and developed the first public dataset to promote malware research.• In survey of cyber-attacks 6.2\% financial attacks are due to malware which increase to 1.3 \% in 2013 compared to 2012.• Financial data theft causes 27.6\% to reach 28,400,000. Victims abused by this targeting malware countered 3,800,000, which is 18.6\% greater than previous year.• Finance-committed malware, associated with Bitcoin has demonstrated the most dynamic development. Where's, Zeus is still top listed for playing important roles to steal banking credentials.Solutionary study stats that companies are spending a staggering amount of money in the aftermath of damaging attack: DDoS attacks recover $6,500 per hour from malware and more than $3,000 each time for up to 30 days to moderate and improve from malware attacks. [1]},
booktitle = {Proceedings of the Second International Conference on Information and Communication Technology for Competitive Strategies},
articleno = {145},
numpages = {4},
keywords = {Malware, API, financial losses, Survey},
location = {Udaipur, India},
series = {ICTCS '16}
}

View File

@@ -0,0 +1,17 @@
@inproceedings{10.1145/3133956.3134067,
author = {Thomas, Kurt and Li, Frank and Zand, Ali and Barrett, Jacob and Ranieri, Juri and Invernizzi, Luca and Markov, Yarik and Comanescu, Oxana and Eranti, Vijay and Moscicki, Angelika and Margolis, Daniel and Paxson, Vern and Bursztein, Elie},
title = {Data Breaches, Phishing, or Malware? Understanding the Risks of Stolen Credentials},
year = {2017},
isbn = {9781450349468},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3133956.3134067},
doi = {10.1145/3133956.3134067},
abstract = {In this paper, we present the first longitudinal measurement study of the underground ecosystem fueling credential theft and assess the risk it poses to millions of users. Over the course of March, 2016--March, 2017, we identify 788,000 potential victims of off-the-shelf keyloggers; 12.4 million potential victims of phishing kits; and 1.9 billion usernames and passwords exposed via data breaches and traded on blackmarket forums. Using this dataset, we explore to what degree the stolen passwords---which originate from thousands of online services---enable an attacker to obtain a victim's valid email credentials---and thus complete control of their online identity due to transitive trust. Drawing upon Google as a case study, we find 7--25\% of exposed passwords match a victim's Google account. For these accounts, we show how hardening authentication mechanisms to include additional risk signals such as a user's historical geolocations and device profiles helps to mitigate the risk of hijacking. Beyond these risk metrics, we delve into the global reach of the miscreants involved in credential theft and the blackhat tools they rely on. We observe a remarkable lack of external pressure on bad actors, with phishing kit playbooks and keylogger capabilities remaining largely unchanged since the mid-2000s.},
booktitle = {Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security},
pages = {14211434},
numpages = {14},
keywords = {keylogger, phishing, risk analysis, data breach, password reuse, authentication, phishing kit, password},
location = {Dallas, Texas, USA},
series = {CCS '17}
}

View File

@@ -0,0 +1,10 @@
@article{article,
author = {Creutzburg, Reiner},
year = {2017},
month = {01},
pages = {139-148},
title = {The strange world of keyloggers - an overview, Part I},
volume = {2017},
journal = {Electronic Imaging},
doi = {10.2352/ISSN.2470-1173.2017.6.MOBMU-313}
}

View File

@@ -1,8 +1,8 @@
{ {
"white_listed_programs": [ "white_listed_programs": [
"systemd_logind", "systemd_logind",
"gnome-shell", "systemd",
"systemd" "gnome-shell"
], ],
"auto_kill_programs": [], "auto_kill_programs": [],
"kbd_names": [ "kbd_names": [

View File

@@ -1,8 +0,0 @@
probe kernel.function("register_keyboard_notifier").call
{
printf("%s (%d)\n", execname(),tid())
}
probe end{
printf("end\n")
}

View File

@@ -1,58 +0,0 @@
#! /usr/bin/env stap
#
# Copyright (C) 2010-2015 Red Hat, Inc.
# Written by William Cohen <wcohen@redhat.com>
#
# The linetimes.stp script takes two arguments: where to find the function
# and the function name. linetimes.stp will instrument each line in the
# function. It will print out the number of times that the function is
# called, a table with the average and maximum time each line takes,
# and control flow information when the script exits.
#
# For example all the lines of the do_unlinkat function:
#
# stap linetimes.stp kernel do_unlinkat
global calls, times, last_pp, region, cfg
probe $1.function(@2).call { calls <<< 1 }
probe $1.function(@2).return {
t = gettimeofday_us()
s = times[tid()]
if (s) {
e = t - s
region[last_pp[tid()]] <<< e
cfg[last_pp[tid()], pp()] <<< 1
}
delete times[tid()]
delete last_pp[tid()]
}
probe $1.statement(@2 "@*:*") {
t = gettimeofday_us()
s = times[tid()]
if (s) {
e = t - s
region[last_pp[tid()]] <<< e
cfg[last_pp[tid()], pp()] <<< 1
}
times[tid()] = t
last_pp[tid()] = pp()
}
probe end {
printf("\n%s %s call count: %d\n", @1, @2, @count(calls));
printf("\n%-58s %10s %10s\n", "region", "avg(us)", "max(us)");
foreach (p+ in region) {
printf("%-58s %10d %10d\n", p, @avg(region[p]), @max(region[p]));
}
printf("\n\ncontrol flow graph information\n")
printf("from\n\tto\n=======================\n")
foreach ([src+] in region) {
printf("%-s\n", src)
foreach ([s,dest+] in cfg[src,*]) { # slice for all dest's
printf("\t%-s %d\n", dest, @count(cfg[src,dest]));
}
}
}

59
src/kernel_detector.py Normal file → Executable file
View File

@@ -1,3 +1,5 @@
#!/usr/bin/env python3
import subprocess import subprocess
import time import time
import multiprocessing import multiprocessing
@@ -136,43 +138,42 @@ def detect_logger(module):
# #
#============================================================================================================== #==============================================================================================================
def run_kernel_detection: whitelist = get_whitelist("whitelist.txt")
whitelist = get_whitelist("whitelist.txt")
lsmod_output = list_modules("lsmod"); lsmod_output = list_modules("lsmod");
sus_modules = compare_mods(whitelist, lsmod_output) sus_modules = compare_mods(whitelist, lsmod_output)
sus_modules = tidy_up(sus_modules) sus_modules = tidy_up(sus_modules)
sus_modules = unload_mod(sus_modules) sus_modules = unload_mod(sus_modules)
time.sleep(1) time.sleep(1)
sus_modules = getpath(sus_modules) sus_modules = getpath(sus_modules)
print(sus_modules) print(sus_modules)
if len(sus_modules) == 0: if len(sus_modules) == 0:
print("nothing to do") print("nothing to do")
print("ALL CLEAN") print("ALL CLEAN")
exit()
suspects = [] suspects = []
for module in sus_modules: for module in sus_modules:
suspects.append(detect_logger(module)) suspects.append(detect_logger(module))
time.sleep(1) time.sleep(1)
print("Following modules are logging your keystrokes: ") print("Following modules are logging your keystrokes: ")
for i in range(len(suspects)): for i in range(len(suspects)):
print( f"[{i}] {suspects[i]}") print( f"[{i}] {suspects[i]}")
print("Enter the number of the module you want to remove: ") print("Enter the number of the module you want to remove: ")
user_input = input().split() user_input = input().split()
for j in user_input: for j in user_input:
to_remove = suspects[int(j)] to_remove = suspects[int(j)]
subprocess.Popen(['sudo','rmmod', to_remove]) subprocess.Popen(['sudo','rmmod', to_remove])
print(f"Removed {to_remove}") print(f"Removed {to_remove}")
print("Finished") print("Finished")

View File

@@ -22,6 +22,8 @@ safe_option = False
add_white_list_option = False add_white_list_option = False
add_black_list_option = False add_black_list_option = False
debug_option = False debug_option = False
kernel_detection_option = False
# Functions # Functions
def debug(option, to_print): def debug(option, to_print):
@@ -35,9 +37,10 @@ def print_help():
print(' -v, --verbose\t\t\tVerbose mode. Informative information will be displayed duting execution') print(' -v, --verbose\t\t\tVerbose mode. Informative information will be displayed duting execution')
print(' -a, --auto-kill\t\tAutomatically kill blacklisted processes') print(' -a, --auto-kill\t\tAutomatically kill blacklisted processes')
print(' -s, --safe\t\t\tSafe mode. Asked to confirm before killing a process') print(' -s, --safe\t\t\tSafe mode. Asked to confirm before killing a process')
print(' -w, --add-white-list\t\t\tActivate prompt to add program names to the whitelist') #For some reason this line gets messed up in display print(' -w, --add-white-list\t\tActivate prompt to add program names to the whitelist') #For some reason this line gets messed up in display
print(' -b, --add-black-list\t\t\tAutomatically add program names chosen to kill to the blacklist') print(' -b, --add-black-list\t\tAutomatically add program names chosen to kill to the blacklist')
print(' -d, --debug\t\t\tDebug mode. Print debug statements') print(' -d, --debug\t\t\tDebug mode. Print debug statements')
print(' -k, --kernel-detection\t\tRun the kernel keylogger detector, too. CURRENTLY NOT IMPLEMENTED TO DIRECTLY RUN KERNEL DETECTOR.')
def set_input_options(): def set_input_options():
""" """
@@ -50,7 +53,7 @@ def set_input_options():
""" """
global auto_kill_option, verbose_option, safe_option, add_white_list_option global auto_kill_option, verbose_option, safe_option, add_white_list_option
global debug_option, add_black_list_option global debug_option, add_black_list_option, kernel_detection_option
if len(sys.argv) > 1: if len(sys.argv) > 1:
for arg in sys.argv[1:]: for arg in sys.argv[1:]:
print(arg) print(arg)
@@ -69,6 +72,8 @@ def set_input_options():
add_black_list_option = True add_black_list_option = True
elif arg == '-d' or arg == '--debug': elif arg == '-d' or arg == '--debug':
debug_option = True debug_option = True
elif arg == '-k' or arg == '--kernel-detection':
kernel_detection_option = True
def confirm_kill_procces(process_name, times=0): def confirm_kill_procces(process_name, times=0):
@@ -116,7 +121,7 @@ def detect_keyloggers():
debug(True, str(sys.argv)) # Set manually to debug if args are being read debug(True, str(sys.argv)) # Set manually to debug if args are being read
check_platform() check_platform()
global auto_kill_option, verbose_option, safe_option global auto_kill_option, verbose_option, safe_option, add_white_list_option, kernel_detection_option, debug_option
set_input_options() set_input_options()
if verbose_option: if verbose_option:
print('[Verbose] Input options set') print('[Verbose] Input options set')
@@ -205,7 +210,8 @@ def detect_keyloggers():
############################ ############################
if len(suspicious_processes) == 0: if len(suspicious_processes) == 0:
print("[+] No suspicious processes found") print("[+] No suspicious processes found")
sys.exit(0) if not kernel_detection_option:
exit(0)
############################ ############################
# 7. Prompt user to chose which processes (not covered by auto kill if set) to kill # 7. Prompt user to chose which processes (not covered by auto kill if set) to kill
@@ -284,9 +290,13 @@ def detect_keyloggers():
print('[+] Program completed. Exiting.') print('[+] Program completed. Exiting.')
debug(debug_option, 'Kernel detection option: ' + str(kernel_detection_option))
if __name__ == '__main__': if __name__ == '__main__':
detect_keyloggers() detect_keyloggers()