  The core network architecture of telecommunication systems has undergone a
paradigm shift in the fifth-generation (5G)networks. 5G networks have
transitioned to software-defined infrastructures, thereby reducing their
dependence on hardware-based network functions. New technologies, like network
function virtualization and software-defined networking, have been incorporated
in the 5G core network (5GCN) architecture to enable this transition. This has
resulted in significant improvements in efficiency, performance, and robustness
of the networks. However, this has also made the core network more vulnerable,
as software systems are generally easier to compromise than hardware systems.
In this article, we present a comprehensive security analysis framework for the
5GCN. The novelty of this approach lies in the creation and analysis of attack
graphs of the software-defined and virtualized 5GCN through machine learning.
This analysis points to 119 novel possible exploits in the 5GCN. We demonstrate
that these possible exploits of 5GCN vulnerabilities generate five novel
attacks on the 5G Authentication and Key Agreement protocol. We combine the
attacks at the network, protocol, and the application layers to generate
complex attack vectors. In a case study, we use these attack vectors to find
four novel security loopholes in WhatsApp running on a 5G network.
