En la actualidad, la seguridad en los sistemas de autenticación cobra una importancia crítica debido al aumento de ciberataques y al uso generalizado de servicios digitales. Este Trabajo de Fin de Grado se centra en el diseño e implementación de un sistema de autenticación de segundo factor (2FA) basado en el protocolo D2OTP (Doble Dinámica OTP), que introduce un enfoque innovador para mejorar la seguridad mediante claves efímeras y autenticación mutua, sin depender de criptografía asimétrica ni infraestructura PKI.
El proyecto abarca el desarrollo completo de una solución 2FA que incluye una API RESTful construida con FastAPI, una aplicación móvil autenticadora multiplataforma desarrollada con Kotlin Multiplatform Mobile (KMM), y una infraestructura en la nube basada en Firebase para almacenamiento y mensajería. El sistema permite verificar operaciones sensibles a través de un canal alternativo cifrado, utilizando el protocolo D2OTP, que garantiza la confidencialidad, integridad y autenticidad de los mensajes intercambiados entre cliente y servidor.
Se ha implementado una librería criptográfica D2OTP tanto en Python (para el backend) como en Kotlin (para la app móvil), que permite codificar y decodificar los mensajes OTP con claves efímeras. El protocolo D2OTP evita la reutilización de secretos, previene ataques de phishing y man-in-the-middle, y cumple con regulaciones como la directiva PSD2 en cuanto a autenticación reforzada y firma dinámica.
El sistema fue sometido a un análisis exhaustivo de requisitos funcionales y no funcionales, así como a un modelo de amenazas basado en STRIDE y OWASP Mobile Top 10. Se identificaron y mitigaron múltiples riesgos asociados a la suplantación de identidad, divulgación de información, manipulación de datos y elevación de privilegios, estableciendo un marco sólido de protección integral.
En cuanto a la implementación, se construyó una arquitectura modular y escalable con los siguientes componentes: una app cliente que solicita la autenticación, un backend que orquesta el flujo de verificación y una app 2FA que permite al usuario aprobar o rechazar la operación. La comunicación se realiza mediante mensajes cifrados (M1, M2, M3) siguiendo el flujo definido por D2OTP, reforzados por un canal alternativo (push o SMS).
Aunque el sistema es funcional y robusto, se identificaron algunas limitaciones, como la falta de integración completa de notificaciones push y la ausencia de mecanismos de recuperación en caso de pérdida del dispositivo autenticador. Estas carencias no comprometen la seguridad del sistema, pero representan áreas de mejora para futuras versiones.
En conclusión, este proyecto demuestra la viabilidad y ventajas de aplicar el protocolo D2OTP como solución de segundo factor en contextos donde se requiere alta seguridad, pero se desea evitar la complejidad y coste de los sistemas basados en criptografía asimétrica. La solución desarrollada proporciona una base sólida para futuras investigaciones y despliegues de sistemas de autenticación avanzados, adaptables y centrados en la experiencia del usuario.
ABSTRACT
Nowadays, security in authentication systems is critically important due to the rise in cyberattacks and the widespread use of digital services. This Final Degree Project focuses on the design and implementation of a two-factor authentication (2FA) system based on the D2OTP (Double Dynamic OTP) protocol, which introduces an innovative approach to improve security through ephemeral keys and mutual authentication, without relying on asymmetric cryptography or PKI infrastructure.
The project involves the complete development of a 2FA solution, including a RESTful API built with FastAPI, a cross-platform authenticator mobile application developed with Kotlin Multiplatform Mobile (KMM), and a cloud infrastructure based on Firebase for storage and messaging. The system verifies sensitive operations through an encrypted alternative channel, using the D2OTP protocol, which ensures the confidentiality, integrity, and authenticity of messages exchanged between client and server.
A D2OTP cryptographic library was implemented in both Python (for the backend) and Kotlin (for the mobile app), enabling the encoding and decoding of OTP messages with ephemeral keys. The D2OTP protocol avoids the reuse of secrets, prevents phishing and man-in-the-middle attacks, and complies with regulations such as the PSD2 directive in terms of strong customer authentication and dynamic linking.
The system was subjected to a thorough analysis of functional and non�functional requirements, as well as a threat model based on STRIDE and OWASP Mobile Top 10. Multiple risks associated with identity spoofing, information disclosure, data tampering, and privilege escalation were identified and mitigated, establishing a solid framework for comprehensive protection.
The implementation includes a modular and scalable architecture composed of the following components: a client app that initiates the authentication request, a backend that orchestrates the verification flow, and a 2FA app that allows the user to approve or reject the operation. Communication is carried out through encrypted messages (M1, M2, M3) following the D2OTP-defined flow, reinforced by an alternate channel (push or SMS).
Although the system is functional and robust, some limitations were identified, such as the incomplete integration of push notifications and the absence of recovery mechanisms in case of loss of the authenticator device. These shortcomings do not compromise the system’s security but represent improvement areas for future versions.
In conclusion, this project demonstrates the feasibility and benefits of applying the D2OTP protocol as a second-factor solution in contexts that require high security but aim to avoid the complexity and cost of systems based on asymmetric cryptography. The solution developed provides a solid foundation for future research and deployment of advanced, adaptable authentication systems centered on user experience.
En la actualidad, la seguridad en los sistemas de autenticación cobra una importancia crítica debido al aumento de ciberataques y al uso generalizado de servicios digitales. Este Trabajo de Fin de Grado se centra en el diseño e implementación de un sistema de autenticación de segundo factor (2FA) basado en el protocolo D2OTP (Doble Dinámica OTP), que introduce un enfoque innovador para mejorar la seguridad mediante claves efímeras y autenticación mutua, sin depender de criptografía asimétrica ni infraestructura PKI.
El proyecto abarca el desarrollo completo de una solución 2FA que incluye una API RESTful construida con FastAPI, una aplicación móvil autenticadora multiplataforma desarrollada con Kotlin Multiplatform Mobile (KMM), y una infraestructura en la nube basada en Firebase para almacenamiento y mensajería. El sistema permite verificar operaciones sensibles a través de un canal alternativo cifrado, utilizando el protocolo D2OTP, que garantiza la confidencialidad, integridad y autenticidad de los mensajes intercambiados entre cliente y servidor.
Se ha implementado una librería criptográfica D2OTP tanto en Python (para el backend) como en Kotlin (para la app móvil), que permite codificar y decodificar los mensajes OTP con claves efímeras. El protocolo D2OTP evita la reutilización de secretos, previene ataques de phishing y man-in-the-middle, y cumple con regulaciones como la directiva PSD2 en cuanto a autenticación reforzada y firma dinámica.
El sistema fue sometido a un análisis exhaustivo de requisitos funcionales y no funcionales, así como a un modelo de amenazas basado en STRIDE y OWASP Mobile Top 10. Se identificaron y mitigaron múltiples riesgos asociados a la suplantación de identidad, divulgación de información, manipulación de datos y elevación de privilegios, estableciendo un marco sólido de protección integral.
En cuanto a la implementación, se construyó una arquitectura modular y escalable con los siguientes componentes: una app cliente que solicita la autenticación, un backend que orquesta el flujo de verificación y una app 2FA que permite al usuario aprobar o rechazar la operación. La comunicación se realiza mediante mensajes cifrados (M1, M2, M3) siguiendo el flujo definido por D2OTP, reforzados por un canal alternativo (push o SMS).
Aunque el sistema es funcional y robusto, se identificaron algunas limitaciones, como la falta de integración completa de notificaciones push y la ausencia de mecanismos de recuperación en caso de pérdida del dispositivo autenticador. Estas carencias no comprometen la seguridad del sistema, pero representan áreas de mejora para futuras versiones.
En conclusión, este proyecto demuestra la viabilidad y ventajas de aplicar el protocolo D2OTP como solución de segundo factor en contextos donde se requiere alta seguridad, pero se desea evitar la complejidad y coste de los sistemas basados en criptografía asimétrica. La solución desarrollada proporciona una base sólida para futuras investigaciones y despliegues de sistemas de autenticación avanzados, adaptables y centrados en la experiencia del usuario.
ABSTRACT
Nowadays, security in authentication systems is critically important due to the rise in cyberattacks and the widespread use of digital services. This Final Degree Project focuses on the design and implementation of a two-factor authentication (2FA) system based on the D2OTP (Double Dynamic OTP) protocol, which introduces an innovative approach to improve security through ephemeral keys and mutual authentication, without relying on asymmetric cryptography or PKI infrastructure.
The project involves the complete development of a 2FA solution, including a RESTful API built with FastAPI, a cross-platform authenticator mobile application developed with Kotlin Multiplatform Mobile (KMM), and a cloud infrastructure based on Firebase for storage and messaging. The system verifies sensitive operations through an encrypted alternative channel, using the D2OTP protocol, which ensures the confidentiality, integrity, and authenticity of messages exchanged between client and server.
A D2OTP cryptographic library was implemented in both Python (for the backend) and Kotlin (for the mobile app), enabling the encoding and decoding of OTP messages with ephemeral keys. The D2OTP protocol avoids the reuse of secrets, prevents phishing and man-in-the-middle attacks, and complies with regulations such as the PSD2 directive in terms of strong customer authentication and dynamic linking.
The system was subjected to a thorough analysis of functional and non�functional requirements, as well as a threat model based on STRIDE and OWASP Mobile Top 10. Multiple risks associated with identity spoofing, information disclosure, data tampering, and privilege escalation were identified and mitigated, establishing a solid framework for comprehensive protection.
The implementation includes a modular and scalable architecture composed of the following components: a client app that initiates the authentication request, a backend that orchestrates the verification flow, and a 2FA app that allows the user to approve or reject the operation. Communication is carried out through encrypted messages (M1, M2, M3) following the D2OTP-defined flow, reinforced by an alternate channel (push or SMS).
Although the system is functional and robust, some limitations were identified, such as the incomplete integration of push notifications and the absence of recovery mechanisms in case of loss of the authenticator device. These shortcomings do not compromise the system’s security but represent improvement areas for future versions.
In conclusion, this project demonstrates the feasibility and benefits of applying the D2OTP protocol as a second-factor solution in contexts that require high security but aim to avoid the complexity and cost of systems based on asymmetric cryptography. The solution developed provides a solid foundation for future research and deployment of advanced, adaptable authentication systems centered on user experience. Read More


