Urgent.News

What's breaking now, across thousands of outlets.

AI

I Added ML Anamoly Detection to My Cybersecurity Tool - Here's What the Numbers Actually Showed

A few weeks ago, I built Log Sentinel, a log analysis dashboard that detects brute force attacks, directory scanning, and error spikes in Apache server logs using rule-based detectors. The rules worked well, but I kept wondering: what would a machine learning model catch that my rules missed? And more importantly, would ML actually be better? I spent two weeks adding an Isolation Forest model to…

After adding machine learning anomaly detection to my cybersecurity tool, I found out intriguing results about its performance. My Log Sentinel tool initially relied on rule-based detectors to identify brute force attacks, directory scanning, and error spikes in Apache server logs. While these rules were effective, I wanted to see if a machine learning model could uncover things the rules missed. I integrated an Isolation Forest model to compare its performance with the rule-based system.

The Isolation Forest operates differently from the rules by learning the normal traffic patterns from the data itself. It flags anything that deviates statistically from these patterns, transforming each IP address into a five-feature behavioral vector. This vector includes total requests made, error rate, number of unique paths visited, fraction of requests during nighttime hours, and average response size. Normalizing these features ensures the model treats all IPs fairly, regardless of scale.

To test the model, I created a labelled dataset of 230 IPs, with 200 normal and 30 attackers (broken down into brute force, directory scanning, and error spiking). By calculating precision, recall, and F1 score, I assessed the performance of both detectors. The rule-based system achieved perfect precision, recall, and F1 scores, while the Isolation Forest correctly identified all attackers (recall=1.0) but also flagged five innocent IPs (precision=0.857).

Initially, I was disappointed by the Isolation Forest's false positives. However, upon further reflection, I realized their value. The model identified five normal IPs that exhibited slightly unusual behavior, which might be significant in a real-world setting. Rules only catch anticipated attack patterns, while the ML model uncovers unexpected anomalies. Therefore, both detectors are essential in my cybersecurity tool.

My dashboard now displays both detectors' results, highlighting where they agree and disagree, providing insight into potentially interesting cases. To improve my evaluation in the future, I plan to use real labeled log data from a production environment instead of synthetic data. Additionally, I aim to compare other unsupervised algorithms like Local Outlier Factor and One-Class SVM with the Isolation Forest.

The live dashboard now showcases both detectors' results side-by-side, featuring confusion matrices and F1 scores for easy comparison.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in AI

The United States is pushing for an AI alliance that requires member countries to choose between the US and China, with South Korea also being considered as a potential member. The US is reportedly planning to create an AI alliance with like-minded countries, including Australia, Canada, France, Germany, Japan, and the UK, to counter China's growing influence in the field. The alliance, which is still in its early stages, aims to promote a free and open AI ecosystem, while also ensuring that member countries do not use AI technologies developed by China. According to sources, the US is considering requiring member countries to sign a non-disclosure agreement that would prevent them from sharing AI-related information with China. The US is also expected to provide significant funding to support the development of AI technologies in member countries, with the goal of creating a global AI supply chain that is not dependent on China. South Korea, which has been actively promoting its own AI industry, is reportedly being considered as a potential member of the alliance. The Korean government has been closely monitoring the development of the alliance, and is expected to make a decision on whether to join in the near future. The US-China rivalry in the field of AI is expected to intensify in the coming years, with both countries investing heavily in the development of AI technologies. The US has been working to strengthen its partnerships with like-minded countries in the field of AI, while also taking steps to restrict China's access to AI-related technologies. In recent months, the US has imposed restrictions on Chinese companies, including Huawei, from accessing US AI technologies. China, on the other hand, has been actively promoting its own AI industry, and has made significant investments in the development of AI technologies. The global AI market is expected to grow significantly in the coming years, with estimates suggesting that it will reach $190 billion by 2025. The US and China are currently the two largest players in the global AI market, and are expected to continue to dominate the market in the coming years. However, the emergence of new players, including South Korea, is expected to challenge the dominance of the US and China in the global AI market. The AI alliance is expected to play a significant role in shaping the global AI landscape, and could have significant implications for the future of AI development. The alliance is also expected to have significant implications for South Korea, which has been actively promoting its own AI industry. The Korean government has been closely monitoring the development of the alliance, and is expected to make a decision on whether to join in the near future. The decision on whether to join the alliance is expected to have significant implications for South Korea's AI industry, and could potentially impact the country's future economic growth. The US is expected to continue to play a significant role in shaping the global AI landscape, and is likely to remain a major player in the field of AI for years to come.

More from Saturday 15 August →