How bansh2ebreak/springvulnboot-backend works
Project Type & Purpose
• This project is a backend component of a Java security training platform built on Spring Boot.
• Its purpose is to simulate various web vulnerabilities (SQL Injection, XSS, remote code execution, file upload bugs, path traversal, URL redirection, etc.) for learning, practical exercises, and penetration testing.
• Although the front-end is handled by a separate Vue-based repository, this backend focuses on providing vulnerable endpoints and business logic for the security lab scenarios.
File Structure Analysis
• Key Top-Level Files/Directories:
• pom.xml: Indicates use of Maven for dependency management and build.
• src/main/java/icu/secnotes: Contains the main application code.
• Controller sub-packages (Authentication, Components, FileUpload, PathTraversal, RCE, Redirect, SQLI, XSS): Each exposing endpoints simulating a specific vulnerability.
• Service and Mapper directories: Represent the service (business logic) and data access layers respectively.
• Config package: Contains configuration classes such as CorsConfig and WebConfig, which manage cross-origin requests and other web settings.
• Exception and Interceptor packages: Provide error handling routines and pre-request checks (e.g., LoginCheckInterceptor).
• Resources: Holds configuration files (application.yml, log configurations) and static assets (including vulnerable JSP pages).
Elements
a. Main Components:
• Frontend Component (external Vue Admin Template): Although in a different repository, include it as a consumer of the backend APIs.
• Spring Boot Application (Backend Server): The core of the system.
▫ Entry point: SpringVulnBootApplication.java.
▫ Controllers: Expose API endpoints for each type of vulnerability.
▫ Services: Contain business logic (e.g., LoginService, SmsCodeService).
▫ Data Access Layer: Mapper interfaces that communicate with the database.
▫ Exception Handling & Interceptors: GlobalExceptionHandler and LoginCheckInterceptor to manage request flows.
▫ Utility Components: Classes like JwtUtils and Security for security operations.
• Database: Represented by db.sql (implies there is an underlying SQL database that stores application data).
• External files/configurations: Highlight elements managed by pom.xml (dependencies) and application.yml (runtime configurations).
b. Relationships & Interactions:
• The Frontend sends HTTP requests (API calls) to the Spring Boot backend.
• The controllers route these requests into various services.
• Services process business logic and invoke mappers to interact with the database.
• Config classes (CorsConfig and WebConfig) and interceptors manage request routing, security headers, and validation.
• Exception handlers capture errors across the controllers.
c. Architectural Patterns/Design Principles:
• Layered Architecture:
▫ Presentation Layer: Controllers handling HTTP request/response cycles.
▫ Business Logic Layer: Service classes implementing the core functionality.
▫ Data Access Layer: Mappers interfacing with the database.
• Separation of Concerns: Each vulnerability demonstration is placed in its own package (e.g., for SQLI, XSS) making it modular.
• Use of configuration management (Spring Boot’s application.yml) and dependency injection inherent to Spring.
d. Relevant Technologies & Frameworks:
• SpringBoot (main framework) for building the backend.
• Java for implementation.
• Maven (pom.xml) for build and dependency management.
• Database (as per db.sql) likely running on a relational database.
• Various Spring modules for web, security, and data access.
• Integration of logging (log4j2) and external configurations (ESAPI.properties).