Chaos-Based Frog Leaping Algorithm Boosts Machine Learning SQL Injection

Bioengineer.org

Source published: Site published:

Original article · فارسی

Computer scientists have created an improved method that helps machine learning systems detect structured query language injection attacks, or SQL injection attacks, against web applications. At the same time, it cuts the number of features the system must process by about 70 percent. The study, published in Discover Internet of Things by Bahman Arasteh, Huseyin Kusetogullari, and Keyvan Arasteh, describes an improved chaos-based binary shuffled frog-leaping algorithm called bSFLA. It was designed specifically to choose useful groups of features. Structured query language injection, usually called SQLi, is still listed by the Open Web Application Security Project as one of the most serious security weaknesses affecting modern digital systems. Attackers can change the database queries made by an application. This can let them get around login checks, steal sensitive company records, or even take control of backend systems. Machine learning classifiers are widely used to tell safe activity from harmful input in cloud services, online stores, and online banking. But traditional models can produce too many false alarms and other errors, and they can become slower when they must process many features that are repeated or not useful.

Finding the best set of features is a known non-deterministic polynomial-time complete combinatorial optimization problem. An algorithm must search through promising choices among 2 to the power of n possible feature sets instead of checking every possible set. Traditional cybersecurity feature-selection methods often use fixed, rule-based signs that may not work against new kinds of attacks. Other methods use normal random starting points, which can cause the search to stop too early at a solution that is good but not the best. Feature sets that have not been optimized can also contain overlapping noise. This can distort the mathematical boundaries that supervised classifiers use to make decisions. To deal with these problems, the researchers created a clear and interpretable optimization method. It combines the group-foraging behavior used in the shuffled frog-leaping algorithm with deterministic chaos theory. The bSFLA method uses chaotic population initialization, separate memeplex evolution, stochastic binary transformations, and regular shuffling. It finds small but highly useful feature sets containing about 30 percent of the original features, while improving classification accuracy, sensitivity, precision, and harmonic stability.

The basic design of the proposed bSFLA model uses a search process with several stages. It is inspired by groups of leaping frogs divided among different environmental groups called memeplexes. To spread the starting population evenly and avoid the clustering that can happen with normal pseudo-random starting methods, the authors used a chaotic logistic map. It follows a repeating mathematical rule with an experimentally chosen growth parameter, r, set to four. This chaotic sequence creates continuing, non-repeating starting positions for the frogs, with values between zero and one. Each frog represents one possible solution. It is stored as a binary vector for the available features: one means a feature is included, and zero means it is left out. The full group of possible solutions is then ranked by fitness and divided into m separate memeplexes. Inside each memeplex, the least-fit frog repeatedly changes its position by learning from the best frog in that group. If this does not improve its fitness, it moves toward the best solution in the whole population. If needed, it then uses two-point crossover and two-point mutation before finally using random replacement.

The algorithm must turn continuous position values into simple yes-or-no choices about which features to use. It does this with a special binary mapping method based on the logistic sigmoid transformation. Because the frog positions are continuous numbers, a sigmoid transfer function changes each position into a smooth probability between zero and one. A stochastic thresholding step then compares this probability with a uniformly distributed random number between zero and one. This produces a binary value of zero or one for each feature. Possible feature sets are judged with a multi-objective fitness function that tries to balance prediction quality with using fewer features. The mathematical goal balances the classifier's error rate against the share of all features that were selected. It uses weighted constants alpha and beta. Alpha is between zero and one, and beta is defined as one minus alpha. This means the algorithm keeps giving a penalty for keeping unnecessary features and gives a reward when classification errors fall significantly.

To test whether the bSFLA method works reliably in different situations, the researchers tested it on two different databases with different sizes, structures, and class distributions. Dataset 1 contains 1,027 structured query records. These include 473 safe, normal queries, such as standard select, insert, update, and delete commands, and 554 harmful injection attacks. The attacks include common patterns such as tautological disjunctions, union select injections, and commands that drop tables. Each Dataset 1 record was represented with twelve numerical structural features. These included query length, nesting depth, counts of special characters, how often union, or, and, and null appeared, quotation marks, and parenthesis counts. Dataset 2 was made to test the method with traffic on an enterprise scale. It contains 30,919 query examples, including 19,537 legitimate queries and 11,382 attack payloads. Its twelve features include measures of lexical complexity, query token lengths, punctuation frequency, the ratio of non-alphanumeric characters, lexical entropy, and simple yes-or-no flags for union select syntax, or-based tautologies, and database sleep commands. To prevent information from the test data from leaking into the prediction process, all numerical features were normalized with min-max normalization calculated only from the chosen training data.

An ablation study on Dataset 1 showed direct and statistically measurable improvements when bSFLA feature selection was used with four main machine learning models: Artificial Neural Networks, Support Vector Machines, K-Nearest Neighbors, and Decision Trees. When the models used all features without pruning across five separate experimental runs, their average results were 95.64 percent accuracy, 96.99 percent sensitivity, 94.24 percent precision, and an F1-score of 95.41 percent. Adding bSFLA feature selection raised these averages to 98.32 percent accuracy, 98.35 percent sensitivity, 97.58 percent precision, and an F1-score of 97.89 percent. That is an absolute improvement of 2.68 percentage points in accuracy, 1.36 points in sensitivity, 3.34 points in precision, and 2.48 points in F1-score. In relative terms, the optimization reduced error rates for accuracy, sensitivity, precision, and F1-score by about 61.5 percent, 45.2 percent, 58.0 percent, and 54.0 percent, respectively. The researchers say this confirms that removing unhelpful features can reduce false-positive alerts without reducing the system's ability to catch attacks.

Tests on Dataset 2 also supported the strength and stability of the method when it was used with a wider range of queries and tested with ten-fold cross-validation. Across the four main classifiers, the models guided by bSFLA reached an overall average accuracy of 99.47 percent, average sensitivity of 98.95 percent, average precision of 99.61 percent, and a combined F1-score of 99.28 percent. Of the tested learning methods, K-Nearest Neighbors performed best. It had an average accuracy of 99.63 percent, sensitivity of 99.23 percent, precision of 99.77 percent, and an F1-score of 99.50 percent. Decision Trees, Artificial Neural Networks, and Support Vector Machines also performed very well, with accuracies of 99.44 percent, 99.44 percent, and 99.37 percent, respectively. By comparison, an extra test of Naive Bayes performed noticeably worse. It had 88.05 percent accuracy, 70.77 percent sensitivity, and an F1-score of 81.33 percent, although its precision was still 95.62 percent. A receiver operating characteristic analysis of the Artificial Neural Network across all ten cross-validation folds found area-under-the-curve values between 0.9976 and 0.9995, with an excellent average area under the curve of 0.9988.

Tracking how often features were selected across repeated runs showed which parts of a query mattered most for correct classification. It also showed that different models depended on somewhat different features. In Dataset 1, the frequency of constant numerical and text values was the most important structural feature. It was selected in 100 percent of all twenty independent runs and classifier setups. Nesting depth and bracket counts were each selected 65 percent of the time. Overall query character length was selected 60 percent of the time, and special-character counts were selected 55 percent of the time. In Dataset 2, normalized feature-importance calculations showed that four main features made up about 75.57 percent of the total importance across all classifiers. Query lexical entropy was highest at 23.91 percent, followed by token length at 19.95 percent, the ratio of non-alphanumeric characters at 19.55 percent, and overall character length at 12.16 percent. Comment dash counts contributed 9.06 percent. Specific yes-or-no indicators such as union select and sleep commands each represented less than one percent of relative importance. This suggests that general measures of word complexity and character makeup are much more dependable for detecting attacks than fragile rules that simply look for certain keywords.

Statistical testing showed that the bSFLA method greatly improves stability and reduces changes in performance between repeated runs. In error-bar comparisons of classification accuracy on Dataset 1, the model using only 30 percent of the available features had a 95 percent confidence-interval error bar of just 0.4386 around an average accuracy of 98.27 percent. The model using all features had a much larger error bar of 2.7517 around a lower average accuracy of 92.01 percent. For Dataset 2, non-parametric Friedman testing across the ten paired cross-validation folds found statistically significant differences among the models. The researchers then used pairwise Wilcoxon signed-rank tests with Holm correction. These tests showed that K-Nearest Neighbors performed significantly better than Support Vector Machines, Decision Trees, and Artificial Neural Networks. Naive Bayes performed significantly worse than all the other models. The differences among Decision Trees, Artificial Neural Networks, and Support Vector Machines were not statistically significant. This supports the idea that the method works well with several different kinds of classifiers.

Even with these strong prediction results and computing benefits, the authors describe important limits that affect how the findings should be understood, and they point to areas for future research. Dataset 1 directly compared performance with and without feature selection under the same conditions. But the Dataset 2 experiments did not record a full-feature baseline without optimization. Because of this, the researchers cannot separate the exact effect of bSFLA from the natural structural properties of the larger dataset. Also, the experimental data came from controlled query-generation systems and recorded access logs, not unrestricted, real-time enterprise traffic. To make the method more useful in web application firewalls and cloud systems where very fast responses are important, future studies plan to combine hand-designed structural features with deep semantic embeddings from transformer systems such as BERT, RoBERTa, and large language models. They also plan to study synthetic oversampling methods such as SMOTE and generative augmentation to better handle extreme class imbalance in new zero-day attack patterns.

Subject of Research: Machine learning feature selection using chaos-based shuffled frog-leaping for SQL injection detection

Article Title: Chaos-based shuffled frog-leaping and machine learning approach for SQL injection detection in web applications

Article References: Arasteh, B., Kusetogullari, H., & Arasteh, K. (2026). Chaos-based shuffled frog-leaping and machine learning approach for SQL injection detection in web applications. Discover Internet of Things, 6(1), Article 281. [https://doi.org/10.1007/s43926-026-00494-5](https://doi.org/10.1007/s43926-026-00494-5)

Image Credits: AI Generated

DOI: 10.1007/s43926-026-00494-5

Keywords: SQL injection detection, feature selection, shuffled frog-leaping algorithm, chaos theory, machine learning, web application security, logistic map, artificial neural network, support vector machine, k-nearest neighbors, decision tree, cross-validation, ROC analysis, cybersecurity, dimensionality reduction, OWASP vulnerabilities, query classification

News Source: Blake Davidson. (November 26, 2026). Chaos-Based Frog Leaping Algorithm Boosts Machine Learning SQL Injection Detection. Scienmag.