To access material, start machines and answer questions login.
What are honeypots?
A is a deliberately vulnerable security tool designed to attract attackers and record the actions of adversaries. Honeypots can be used in a defensive role to alert administrators of potential breaches and to distract attackers away from real infrastructure. Honeypots are also used to collect data on the tools and techniques of adversaries and assist with generating effective defensive measures.
This room will demonstrate the Cowrie from the perspectives of an adversary and security researcher. This room will also highlight the data collected by a Cowrie deployment, some analysis methodologies, and what the gathered data tell us about typical botnet activity.
Interactivity and Classification
A wide variety of honeypots exist so it is helpful to classify them by the level of interactivity provided to adversaries, with most honeypots falling into one of the below categories:
- Low-Interaction honeypots offer little interactivity to the adversary and are only capable of simulating the functions that are required to simulate a service and capture attacks against it. Adversaries are not able to perform any post-exploitation activity against these honeypots as they are unable to fully exploit the simulated service. Examples of low-interaction honeypots include mailoney (opens in new tab) and dionaea (opens in new tab).
- Medium-Interaction honeypots collect data by emulating both vulnerable services as well as the underlying , shell, and file systems. This allows adversaries to complete initial exploits and carry out post-exploitation activity. Note, that unlike, High-Interaction honeypots (see below), the system presented to adversaries is a simulation. As a result, it is usually not possible for adversaries to complete their full range of post-exploitation activity as the simulation will be unable to function completely or accurately. We will be taking a look at the medium-interaction , Cowrie (opens in new tab) in this demo.
- High-Interaction honeypots are fully complete systems that are usually Virtual
Machines that include deliberate vulnerabilities. Adversaries should be
able (but not necessarily allowed) to perform any action against the as it is a complete system. It is important that high-interaction honeypots are carefully managed, otherwise, there is a risk that an adversary could use the as a foothold to attack other resources. Cowrie can also operate as an and management system for high-interaction honeypots.
Deployment Location
Once deployed, honeypots can then be further categorized by the exact location of their deployment:
- Internal honeypots are deployed inside a LAN. This type can act as a way to monitor a network for threats
originating from the inside, for example,
attacks originating from trusted personnel or attacks that by-parse firewalls like attacks. Ideally, these honeypots should never be compromised as this would indicate a significant breach.
- External honeypots are deployed on the open internet and are used to monitor attacks from outside of the LAN. These honeypots are able to collect much more data on attacks since they are effectively guaranteed to be under attack at all times.
The Cowrie
The Cowrie can work both as an or as a simulated shell. The demo machine is running the simulated shell. You can log in using the following credentials:
- IP - MACHINE_IP
- User - root
- Password - <ANY>
As you can see the emulated shell is pretty convincing and could catch an unprepared adversary off guard. Most of the commands work like how you'd expect, and the contents of the match what would be present on an empty Ubuntu 18.04 installation. However, there are ways to identify this type of Cowrie deployment. For example, it's not possible to execute bash scripts as this is a limitation of low and medium interaction honeypots. It's also possible to identify the default installation as it will mirror a Debian 5 Installation and features a user account named Phil. The default also references an outdated .
Create a file and then log back in is the file still there? (Yay/Nay)
Cowrie Event Logging
The wouldn't be of much use without the ability to collect data on the attacks that it's subjected to. Fortunately, Cowrie uses an extensive logging system that tracks every connection and command handled by the system. You can access the real port for this demo machine using the following options:
- IP - MACHINE_IP
- Port - 1400
- User - demo
- Password - demo
Cowrie can log to a variety of different local formats and log parsing suites. In this case, the installation is just using the and text logs. I've installed the parser jq on the demo machine to simplify log parsing.
Note: You may need to delete the demo machine's identity from .ssh/known_hosts as it will differ from the one used in the honeypot. You will also need to specify a port adding -p 1400 to the SSH command. The logs will also be found at /home/cowrie/honeypot/var/log/cowrie
Log Aggregation
The amount of data collected by honeypots, especially external deployments can quickly exceed the point where it's no longer practical to parse manually. As a result, it's often worth deploying Honeypots alongside a logging platform like the stack. Log aggregation platforms can also provide live monitoring capabilities and alerts. This is particularly beneficial when deploying Honeypots, with the intent to respond to attacks rather than to collect data.
What is arguably the most common tool for brute-forcing SSH?
What intrusion prevention software framework is commonly used to mitigate SSH brute-force attacks?
Typical Post Exploitation Activity
The majority of attacks against typical deployments are automated in some way. As a result, most of the post-exploitation activity that takes place after a bot gains initial access to the will follow a broad pattern. In general, most bots will perform a combination of the following:
- Perform some reconnaissance using the
unameornproccommands or by reading the contents of files like/etc/issueand/proc/cpuinfo. It's possible to change the contents of all these files so the honeypot can pretend to be a server or even an IoT toaster. - Install malicious software by piping a remote shell script into bash. Often this is performed using
wgetorcurlthough, bots will occasionally use . Cowrie will download each unique occurrence of a file but prevent the scripts from being executed. Most of the scripts tend to reference cryptocurrency mining in some way. - A more limited number of bots will then perform some anti-forensics tasks by deleting various logs and disabling bash history. This doesn't affect Cowrie since all the actions are logged externally.
Bots are not limited to these actions in any way and there is still some variation in the methods and goals of bots. Run through the questions below to further understand how adversaries typically perform reconnaissance against systems.
What's the full model name of CPU does the honeypot "use"?
uname -a is run? (Yay/Nay)What flag must be set to pipe wget output into bash?
How would you disable bash history using unset?
What brand of device is the bot in the first sample searching for? (BotCommands/Sample1.txt)
What is the name of the group that runs the botnet in the third sample? (BotCommands/Sample3.txt)
Attacks Performed Using Tunnelling
Some bots will not perform any actions directly against and instead will leverage a compromised deployment itself. This is accomplished with the use of tunnels. In short, tunnels forward network traffic between nodes via an encrypted tunnel. tunnels can then add an additional layer of secrecy when attacking other targets as third parties are unable to see the contents of packets that are forwarded through the tunnel. Forwarding via tunnels also allows an adversary to hide their true public IP in much the same way a would.
The IP obfuscation can then be used to facilitate schemes that require the use of multiple different public IP addresses like, SEO boosting and spamming. tunnelling may also be used to by-parse IP-based rate limiting tools like Fail2Ban as an adversary is able to transfer to a different IP once they have been blocked.
Tunnelling Data in Cowrie
By default, Cowrie will record all of the tunnelling requests received by the but, will not forward them on to their destination. This data is of particular importance as it allows for the monitoring and discovery of web attacks, that may not have been found by another . I've included a couple of samples sort of data that can be recorded from tunnels.
Note: Some elements have been redacted from the samples to protect vulnerable servers.
Recap
I hope this room has demonstrated how interesting honeypots can be and how the data that we can collect from them can be used to gain insight into the operations of botnets and other malicious actors.
Extra Resources
I've included some extra resources to assist in learning more about honeypots below:
- Awesome Honeypots (opens in new tab) - A curated list of honeypots
- Cowrie (opens in new tab) - The used in the demo
- Sending Cowrie Output to (opens in new tab) - A good example of how to implement live log monitoring
I
would also recommend that you deploy a yourself as it's a great
way to learn. Deploying a is also a great way to understand
how to work with cloud providers since external honeypots are best when deployed to the cloud. Deploying and managing multiple honeypots is also an interesting challenge and a good way to gain practical experience with tools like Ansible (opens in new tab).
Ready to learn Cyber Security?
TryHackMe provides free online cyber security training to secure jobs & upskill through a fun, interactive learning environment.
Already have an account? Log in
