[% META title = "Security Remediation Master Plan" description = "Comprehensive security vulnerability audit and remediation plan for Comserv application. Covers CRITICAL, HIGH, and MEDIUM severity issues identified in security audit (Jan 2026). Includes 13 vulnerabilities, priority sequencing, implementation timeline, and integration with master plan." roles = "admin,security,developer,devops" TemplateType = "Documentation" category = "security,infrastructure,compliance" page_version = "1.01" last_updated = "Sun Jan 05 2026 21:50:00 UTC" %] [% PageVersion = 'root/Documentation/SECURITY_REMEDIATION_PLAN.tt,v 1.01 2026/01/05 21:50:00 zencoder Exp - G.1 SQL Injection Fixes COMPLETED (8 vulns fixed)' [% IF c.session.debug_mode == 1 %] [% PageVersion %] [% END %]
Updated Master Plan Top 10 (Jan 5, 2026): Integrating security into overall master plan priorities
| Rank | Initiative | Category | Severity | Timeline | Impact |
|---|---|---|---|---|---|
| 1 | G.1: SQL Injection Fixes | Security | ð´ CRITICAL (CVSS 9.8) | Week 1 (Jan 6-7) | Database compromise, data theft, system takeover |
| 2 | G.2: Command Injection Prevention | Security | ð´ CRITICAL (CVSS 9.8) | Week 1 (Jan 6-7) | Remote code execution, system compromise |
| 3 | G.3: Weak Password Hashing â Argon2 | Security | ð´ CRITICAL (CVSS 8.1) | Week 1-2 (Jan 6-12) | Credential compromise via brute force/rainbow tables |
| 4 | A.2: K8s Readiness Phase | Infrastructure | ð´ CRITICAL | Week 1-2 (Jan 6-12) | Deployment readiness, system stability |
| 5 | A.1: K8s Migration | Infrastructure | ð´ CRITICAL | Week 2-4 (Jan 13-26) | Production environment modernization |
| 6 | G.4: Session & CSRF Security | Security | ð HIGH (CVSS 7.5) | Week 1-2 (Jan 6-12) | Session hijacking, account takeover, data manipulation |
| 7 | E.1: AI Chat System | Infrastructure | ð HIGH | Week 2-4 (Jan 13-26) | Development productivity, documentation access |
| 8 | G.5: Encryption & Key Management | Security | ð HIGH (CVSS 7.5) | Week 2-3 (Jan 13-19) | Encrypted credential compromise |
| 9 | B.1/B.2: Bug Fixes (Docker Secrets, Auth) | Bugs | ð HIGH | Week 1-2 (Jan 6-12) | System stability, authentication reliability |
| 10 | G.6: Input Validation & Security Headers | Security | ð¡ MEDIUM (CVSS 5.3) | Week 2-3 (Jan 13-19) | Defense-in-depth hardening, OWASP compliance |
Must complete in order: SQL Injection â Command Injection â Password Hashing â Session/CSRF
Parallel Track: G.5 Encryption can proceed alongside password hashing if resources available
Files to Fix:
Admin.pm:330 - database name interpolation in size_queryAdmin.pm:348 - table name interpolation in count_queryImplementation: Use parameterized queries with placeholders (?)
Testing: Run sql_injection_test.pl before commit
Effort: 3-4 hours
Files to Fix:
Admin.pm get_system_stats() function - replace backticks with IPC::Run or Perl equivalentsImplementation: Replace unsafe shell invocation with Perl modules
Testing: Verify system stats still display correctly
Effort: 4-5 hours
Files to Modify:
Controller/User.pm - hash_password() and password verificationModel/User.pm - check_password() methodImplementation: Migrate from SHA-256 to Argon2 with backward compatibility
Testing: Create migration script to rehash existing passwords on next login
Effort: 6-8 hours (includes migration strategy)
Tasks:
Testing: Test CSRF token mismatch scenarios, verify session state
Effort: 5-6 hours
| ID | Vulnerability | Severity | CVSS | Impact | Location |
|---|---|---|---|---|---|
| 1 | SQL Injection | CRITICAL | 9.8 | Database compromise, unauthorized data access, data modification, system takeover | Admin.pm:330 (database name), Admin.pm:348 (table name) |
| 2 | Command Injection (Shell Execution) | CRITICAL | 9.8 | Remote code execution, system compromise, data theft, privilege escalation | Admin.pm backticks (df, uptime, git commands in get_system_stats) |
| 3 | Weak Password Hashing (No Salt) | CRITICAL | 8.1 | Credential compromise via brute force (SHA-256 is fast), rainbow table attacks, account takeover | Controller/User.pm:279 hash_password() uses SHA256 unsalted |
| 4 | Session Cookie Insecurity | HIGH | 7.5 | Session hijacking via MITM attacks, account takeover, session fixation | Comserv.pm:88-95 cookie_secure=0, missing SameSite attribute |
| 5 | No CSRF Protection | HIGH | 7.5 | Unauthorized form submissions, data manipulation, account takeover | All controllers - no CSRF token validation in POST/PUT/DELETE handlers |
| 6 | Hardcoded Admin Bypass | HIGH | 8.8 | Account compromise = full admin access, privilege escalation, system compromise | Util/AdminAuth.pm:45 hardcoded 'Shanta' + 'ai_assistant' usernames grant automatic admin |
| 7 | Weak Encryption (AES-256-CBC, No PBKDF2) | HIGH | 7.5 | Encrypted credential compromise, key derivation attacks, brute force | Util/Encryption.pm iterations=1 (should be 10k+), plaintext key files |
| 8 | Insecure Session State Storage | HIGH | 7.5 | Unauthorized session access, privilege escalation, data theft | Comserv.pm:94 dir=/tmp/session_data (world-readable), loose permissions |
| 9 | Insufficient Input Validation | MEDIUM | 5.3 | XSS attacks, injection attacks, data corruption | Controller/User.pm:611 register() only checks field existence, not format/length |
| 10 | Sensitive Data in Logs | MEDIUM | 5.3 | User enumeration, credential leakage via logs, information disclosure | Controller/User.pm logs username in plaintext during auth attempts |
| 11 | Missing Security Headers | MEDIUM | 3.7 | Clickjacking attacks, XSS attacks, MIME-type sniffing | All controllers - missing X-Frame-Options, X-Content-Type-Options, HSTS |
| 12 | Insecure Encryption Key Storage | MEDIUM | 5.3 | Encryption key compromise, credential decryption, plaintext credential recovery | Util/Encryption.pm keys in /config (world-readable if not chmod 600) |
| 13 | Missing Logging for Auth Events | MEDIUM | 4.2 | Undetected brute force attacks, missing audit trail for security incidents | Controller/User.pm logs failures but no rate limiting or alerting |
Plan: G.1_SQLInjection_Fixes.tt (To be created)
Severity: ð´ CRITICAL | Timeline: Week 1 (Jan 6-7) | Effort: 3-4 hours
Files: Admin.pm (lines 330, 348), other SQL-related code
Plan: G.2_CommandInjection_Prevention.tt (To be created)
Severity: ð´ CRITICAL | Timeline: Week 1 (Jan 7-8) | Effort: 4-5 hours
Files: Admin.pm (get_system_stats, backtick usage)
Plan: G.3_PasswordHashing_Argon2.tt (To be created)
Severity: ð´ CRITICAL | Timeline: Week 1-2 (Jan 8-12) | Effort: 6-8 hours
Files: Controller/User.pm, Model/User.pm, Schema migration
Plan: G.4_Session_CSRF_Security.tt (To be created)
Severity: ð HIGH | Timeline: Week 1-2 (Jan 9-12) | Effort: 5-6 hours
Files: Comserv.pm (session config), all POST/PUT/DELETE controllers
Plan: G.5_Encryption_KeyManagement.tt (To be created)
Severity: ð HIGH | Timeline: Week 2-3 (Jan 13-19) | Effort: 5-6 hours
Files: Util/Encryption.pm, key file management
Plan: G.6_InputValidation_SecurityHeaders.tt (To be created)
Severity: ð¡ MEDIUM | Timeline: Week 2-3 (Jan 13-19) | Effort: 4-5 hours
Files: All controllers, Root.pm (headers), User.pm (registration)
| Day | Task | Duration | Deliverable |
|---|---|---|---|
| Mon 6th | G.1: SQL Injection Analysis & Fixes | 3-4 hrs | Fixed Admin.pm, test suite, PR ready |
| Tue 7th | G.2: Command Injection Prevention | 4-5 hrs | IPC::Run implementation, system_stats() updated, tests |
| Wed 8th | G.3a: Password Hashing Analysis & Schema Update | 3 hrs | Schema migration, backward compatibility plan |
| Thu 9th | G.3b: Argon2 Implementation (parallel: G.5 Encryption Design) | 3 hrs + 2 hrs | User.pm updated with Argon2, migration script ready |
| Fri 10th | G.4a: Session & CSRF Implementation | 3 hrs | Comserv.pm updated, CSRF token generation |
| Sat 11th | G.4b: CSRF Token Integration (Forms) | 2 hrs | All forms updated with tokens, controllers validate |
| Sun 12th | G.1-G.4 Testing & Validation | 3 hrs | Full security test suite, all PRs reviewed |
| Day | Task | Duration | Deliverable |
|---|---|---|---|
| Mon 13th | G.5: Encryption Key Management Hardening | 3 hrs | PBKDF2 implementation, key file permissions (chmod 600) |
| Tue 14th | G.5 Continuation & Documentation | 2 hrs | Encryption.pm updated, secure key rotation guide |
| Wed 15th | G.6: Input Validation (User Registration) | 2 hrs | Data::Validate integration, regex patterns, tests |
| Thu 16th | G.6: Security Headers Implementation | 2 hrs | X-Frame-Options, X-Content-Type-Options, HSTS added to Root.pm |
| Fri 17th | Security Audit Logging & Monitoring Setup | 3 hrs | Hashed username logging, rate limiting config, alerting rules |
| Sat 18th | G.1-G.6 Comprehensive Testing & Documentation | 4 hrs | Full security test coverage, OWASP checklist, documentation |
| Sun 19th | Security Plan Validation & Master Plan Integration | 2 hrs | All G.1-G.6 PRs merged, security.md updated, master plan updated |
Optimal Execution Sequence: G.1 first (CRITICAL), then parallel tracks: (G.2 + G.3 + G.4) in parallel with G.5, then G.6 last
Security Category G (New): Adds 6 security remediation plans to master plan structure
Top 10 Updated (Jan 5, 2026):