Blocking & Detecting Hidden Malicious Data Inside Images
A Spring Boot Security Gateway for Detecting LSB-Based Steganography Before Image Delivery
| Category | Technology | Purpose |
|---|---|---|
| Programming Language | Java 17 | Core application development |
| Framework | Spring Boot | REST API & Security Gateway |
| Build Tool | Maven | Dependency management and project build |
| Image Processing | BufferedImage, ImageIO | Read and analyze uploaded images |
| Steganography Detection | Least Significant Bit (LSB) | Extract hidden binary information |
| Entropy Analysis | Shannon Entropy | Detect suspicious randomness |
| Signature Detection | Binary Signature Scanner | Detect embedded ZIP, EXE, ELF, PDF and more |
| Payload Analysis | Payload Reconstruction | Decode and inspect extracted payload |
| Database | PostgreSQL / H2 | Store logs and application data |
| API Testing | Postman | REST API testing and validation |
| Logging | SLF4J / Logback | Security monitoring and application logs |
| Version Control | Git & GitHub | Source code management |
flowchart LR
A["User A"]
B["Upload Image"]
C["Chat Server"]
D["Store Image"]
E["Forward Image"]
F["User B"]
A --> B
B --> C
C --> D
D --> E
E --> F
flowchart LR
A["Attacker"]
B["Image with Hidden LSB Payload"]
C["Chat Server"]
D["Image Stored"]
E["Image Delivered"]
F["Victim"]
A --> B
B --> C
C --> D
D --> E
E --> F
style B fill:#ff4d4d,color:#000000,stroke:#b30000,stroke-width:3px
style C fill:#ffe6e6,color:#000000
style D fill:#ffe6e6,color:#000000
style E fill:#ffe6e6,color:#000000
style F fill:#ff4d4d,color:#000000,stroke:#b30000,stroke-width:3px
flowchart LR
A["User A"]
B["Upload Image"]
C["StegoShield Gateway"]
D["Security Analysis"]
E{"Image Safe?"}
F["Forward Image"]
G["Reject Upload"]
H["User B"]
A --> B
B --> C
C --> D
D --> E
E -->|YES| F
F --> H
E -->|NO| G
style F fill:#90EE90,color:#000000
style G fill:#ff6666,color:#000000
flowchart TD
UA["Sender"]
UPLOAD["Upload API"]
GATEWAY["StegoShield Gateway"]
BUFFER["BufferedImage Reader"]
LSB["LSB Analyzer"]
ENTROPY["Entropy Calculator"]
SIGNATURE["Binary Signature Scanner"]
PAYLOAD["Payload Decoder"]
ENGINE["Decision Engine"]
ALLOW["Forward Image"]
BLOCK["Reject Upload"]
LOG["Security Log"]
USERB["Receiver"]
UA --> UPLOAD
UPLOAD --> GATEWAY
GATEWAY --> BUFFER
BUFFER --> LSB
BUFFER --> ENTROPY
BUFFER --> SIGNATURE
BUFFER --> PAYLOAD
LSB --> ENGINE
ENTROPY --> ENGINE
SIGNATURE --> ENGINE
PAYLOAD --> ENGINE
ENGINE -->|Safe| ALLOW
ENGINE -->|Malicious| BLOCK
ALLOW --> USERB
ENGINE --> LOG
BLOCK --> LOG
flowchart TD
A["Image Upload"]
B["Validate Request"]
C["Read Image (BufferedImage)"]
D["Extract Pixels"]
E["Extract RGB Values"]
F["Extract Least Significant Bits"]
G["Generate Bit Stream"]
H["Calculate Shannon Entropy"]
I["Scan Binary Signatures"]
J["Attempt Payload Reconstruction"]
K["Generate Analysis Report"]
A --> B
B --> C
C --> D
D --> E
E --> F
F --> G
G --> H
H --> I
I --> J
J --> K
flowchart TD
IMG["Uploaded Image"]
LSB["LSB Score"]
ENT["Entropy Score"]
SIG["Signature Detection"]
PAY["Payload Confidence"]
IMG --> LSB
IMG --> ENT
IMG --> SIG
IMG --> PAY
LSB --> SCORE
ENT --> SCORE
SIG --> SCORE
PAY --> SCORE
SCORE["Combined Risk Score"]
SCORE --> DECISION{"Risk Threshold"}
DECISION -->|Low| SAFE["Safe"]
DECISION -->|High| MAL["Malicious"]
flowchart TD
START["Image Uploaded"]
LSB["LSB Analysis"]
ENTROPY["Entropy Analysis"]
SIGNATURE["Signature Detection"]
PAYLOAD["Payload Reconstruction"]
START --> LSB
START --> ENTROPY
START --> SIGNATURE
START --> PAYLOAD
LSB --> SCORE
ENTROPY --> SCORE
SIGNATURE --> SCORE
PAYLOAD --> SCORE
SCORE["Risk Score"]
SCORE --> THRESHOLD{"Threshold"}
THRESHOLD -->|Low Risk| ALLOW["Allow Upload"]
THRESHOLD -->|High Risk| REJECT["Reject Upload"]
style ALLOW fill:#90EE90,color:#000000
style REJECT fill:#ff6666,color:#000000
sequenceDiagram
participant Sender
participant Gateway
participant Analyzer
participant DecisionEngine
participant Receiver
Sender->>Gateway: Upload Image
Gateway->>Analyzer: Read BufferedImage
Analyzer->>Analyzer: Extract Pixel Data
Analyzer->>Analyzer: LSB Extraction
Analyzer->>Analyzer: Entropy Analysis
Analyzer->>Analyzer: Signature Detection
Analyzer->>Analyzer: Payload Reconstruction
Analyzer->>DecisionEngine: Analysis Report
DecisionEngine-->>Gateway: SAFE
Gateway-->>Receiver: Deliver Image
flowchart TD
A["Threat Detected"] --> B["Reject Upload"]
B --> C["Store Security Log"]
C --> D["Increment User Violation Count"]
D --> E["Temporarily Block User Uploads<br/>(3 Minutes)"]
E --> F["Block Timer Starts"]
F --> G{"3 Minutes Completed?"}
G -->|No| H["Keep User Blocked"]
H --> F
G -->|Yes| I["Restore Upload Access"]
I --> J["User Can Upload Again"]
style A fill:#ff6666,color:#000000,stroke:#b30000,stroke-width:2px
style B fill:#ff9999,color:#000000
style C fill:#ffe699,color:#000000
style D fill:#ffd966,color:#000000
style E fill:#ff4d4d,color:#000000,stroke:#b30000,stroke-width:2px
style I fill:#90EE90,color:#000000
style J fill:#90EE90,color:#000000
|
|
|
|
|
|
|
|
|
|
|
|









