|
| 1 | +# Container Privilege Analysis Report |
| 2 | +*Generated: 2025-08-02* |
| 3 | + |
| 4 | +## 🔍 Executive Summary |
| 5 | + |
| 6 | +**Critical Finding**: 57 out of 108 add-ons (53%) request SYS_ADMIN privileges - a system administration capability that grants near-root access within containers. |
| 7 | + |
| 8 | +**Risk Assessment**: HIGH - The widespread use of SYS_ADMIN significantly increases the attack surface and potential for container escapes. |
| 9 | + |
| 10 | +## 📊 Privilege Usage Statistics |
| 11 | + |
| 12 | +- **Total Add-ons**: 108 |
| 13 | +- **Add-ons with Privileges**: 60 (55%) |
| 14 | +- **SYS_ADMIN Usage**: 57 add-ons (53%) |
| 15 | +- **NET_ADMIN Usage**: 9 add-ons (8%) |
| 16 | +- **DAC_OVERRIDE Usage**: 0 add-ons (0%) ✅ |
| 17 | + |
| 18 | +## 🚨 Top 5 Critical Add-ons Analysis |
| 19 | + |
| 20 | +### 1. Filebrowser (8,427 installations) |
| 21 | +**Privileges**: `SYS_ADMIN`, `DAC_READ_SEARCH` |
| 22 | +**Device Access**: Extensive - All storage devices (sda-sdg, nvme, partitions) |
| 23 | +**Purpose**: Web-based file management interface |
| 24 | + |
| 25 | +**Analysis**: |
| 26 | +- ❌ **Over-privileged**: SYS_ADMIN likely not needed for file browsing |
| 27 | +- ❌ **Excessive device access**: Requests access to ALL possible storage devices |
| 28 | +- ⚠️ **Security risk**: File manager with admin privileges = potential data exfiltration |
| 29 | +- 🔧 **Alternative**: Use bind mounts with specific directories instead of SYS_ADMIN |
| 30 | + |
| 31 | +**Justification Score**: 2/10 - Very weak justification |
| 32 | + |
| 33 | +### 2. Nextcloud (Cloud Storage) |
| 34 | +**Privileges**: `SYS_ADMIN`, `DAC_READ_SEARCH` |
| 35 | +**Device Access**: All storage and video devices |
| 36 | +**Purpose**: Personal cloud storage and collaboration platform |
| 37 | + |
| 38 | +**Analysis**: |
| 39 | +- ⚠️ **Potentially justified**: May need filesystem operations for cloud storage |
| 40 | +- ❌ **Excessive device access**: Duplicate device entries in config |
| 41 | +- 🔧 **Alternative**: Use specific capabilities like `CHOWN`, `FOWNER` instead of SYS_ADMIN |
| 42 | +- ⚠️ **Security concern**: Cloud platform with admin access to all devices |
| 43 | + |
| 44 | +**Justification Score**: 4/10 - Weak justification, alternatives exist |
| 45 | + |
| 46 | +### 3. Plex NAS (Media Server) |
| 47 | +**Privileges**: `SYS_ADMIN`, `DAC_READ_SEARCH` |
| 48 | +**Device Access**: Storage + DVB TV tuners + video hardware |
| 49 | +**Purpose**: Media server with hardware transcoding |
| 50 | + |
| 51 | +**Analysis**: |
| 52 | +- ⚠️ **Partially justified**: Hardware transcoding may require device access |
| 53 | +- ❌ **SYS_ADMIN overkill**: Could use `DEVICE_CONTROL` for hardware access |
| 54 | +- ✅ **Host networking**: Appropriate for media server discovery |
| 55 | +- 🔧 **Alternative**: More specific device capabilities |
| 56 | + |
| 57 | +**Justification Score**: 5/10 - Moderate justification, refinement needed |
| 58 | + |
| 59 | +### 4. Arpspoof (Network Blocker) |
| 60 | +**Privileges**: `SYS_ADMIN`, `DAC_READ_SEARCH` |
| 61 | +**Device Access**: All storage devices (unnecessary) |
| 62 | +**Purpose**: Block internet connection for local network devices |
| 63 | + |
| 64 | +**Analysis**: |
| 65 | +- ✅ **Justified for function**: ARP spoofing requires network manipulation |
| 66 | +- ❌ **Wrong capabilities**: Should use `NET_ADMIN` + `NET_RAW`, not SYS_ADMIN |
| 67 | +- ❌ **Inappropriate device access**: Doesn't need storage device access |
| 68 | +- 🔧 **Alternative**: `NET_ADMIN` + `NET_RAW` capabilities only |
| 69 | + |
| 70 | +**Justification Score**: 3/10 - Wrong privilege type used |
| 71 | + |
| 72 | +### 5. Radarr (Movie Management) |
| 73 | +**Privileges**: `SYS_ADMIN`, `DAC_READ_SEARCH` |
| 74 | +**Device Access**: All storage devices |
| 75 | +**Purpose**: Movie collection management (downloads, organization) |
| 76 | + |
| 77 | +**Analysis**: |
| 78 | +- ❌ **Not justified**: File management doesn't require SYS_ADMIN |
| 79 | +- ❌ **Over-privileged**: Basic file operations don't need admin rights |
| 80 | +- 🔧 **Alternative**: Standard file permissions with proper user mapping |
| 81 | +- ⚠️ **Security risk**: Download manager with admin privileges |
| 82 | + |
| 83 | +**Justification Score**: 1/10 - No justification |
| 84 | + |
| 85 | +## 🔧 Privilege Reduction Recommendations |
| 86 | + |
| 87 | +### Immediate Actions (Week 1) |
| 88 | + |
| 89 | +#### 1. Filebrowser - Remove SYS_ADMIN |
| 90 | +```json |
| 91 | +"privileged": [ |
| 92 | + "DAC_READ_SEARCH" // Keep for file access |
| 93 | +], |
| 94 | +"devices": [ |
| 95 | + "/dev/fuse" // Only FUSE if needed |
| 96 | + // Remove all storage devices, use bind mounts instead |
| 97 | +] |
| 98 | +``` |
| 99 | + |
| 100 | +#### 2. Radarr/Sonarr/Bazarr - Remove SYS_ADMIN |
| 101 | +```json |
| 102 | +"privileged": [ |
| 103 | + "DAC_READ_SEARCH" // Only for reading file attributes |
| 104 | +], |
| 105 | +"devices": [] // Remove all device access |
| 106 | +``` |
| 107 | + |
| 108 | +#### 3. Arpspoof - Fix Privilege Type |
| 109 | +```json |
| 110 | +"privileged": [ |
| 111 | + "NET_ADMIN", // For network manipulation |
| 112 | + "NET_RAW" // For raw socket access |
| 113 | +], |
| 114 | +"devices": [] // Remove storage device access |
| 115 | +``` |
| 116 | + |
| 117 | +### Medium-term Actions (Week 2-4) |
| 118 | + |
| 119 | +#### 4. Nextcloud - Reduce Privileges |
| 120 | +```json |
| 121 | +"privileged": [ |
| 122 | + "CHOWN", // For file ownership changes |
| 123 | + "FOWNER", // For file permission changes |
| 124 | + "DAC_READ_SEARCH" // For file access |
| 125 | +], |
| 126 | +// Remove duplicate device entries |
| 127 | +``` |
| 128 | + |
| 129 | +#### 5. Plex - Specific Hardware Access |
| 130 | +```json |
| 131 | +"privileged": [ |
| 132 | + "DAC_READ_SEARCH" // For media file access |
| 133 | +], |
| 134 | +"devices": [ |
| 135 | + "/dev/dri", // GPU for transcoding |
| 136 | + "/dev/dvb/", // TV tuners only |
| 137 | + // Remove storage devices, use bind mounts |
| 138 | +] |
| 139 | +``` |
| 140 | + |
| 141 | +## 📋 Category-Based Privilege Guidelines |
| 142 | + |
| 143 | +### Media Applications (Plex, Emby, Jellyfin, Radarr, Sonarr) |
| 144 | +**Standard Privileges**: `DAC_READ_SEARCH` only |
| 145 | +**Device Access**: GPU devices for transcoding only |
| 146 | +**Justification**: Media management requires file reading, not system administration |
| 147 | + |
| 148 | +### File Managers (Filebrowser, Nextcloud) |
| 149 | +**Standard Privileges**: `DAC_READ_SEARCH`, optionally `CHOWN`/`FOWNER` |
| 150 | +**Device Access**: None - use bind mounts |
| 151 | +**Justification**: File operations can be handled through proper volume mounting |
| 152 | + |
| 153 | +### Network Tools (Arpspoof) |
| 154 | +**Standard Privileges**: `NET_ADMIN`, `NET_RAW` |
| 155 | +**Device Access**: Network interfaces only |
| 156 | +**Justification**: Network manipulation requires network capabilities, not system admin |
| 157 | + |
| 158 | +### Development Tools (Code-server, Gitea) |
| 159 | +**Standard Privileges**: Minimal - consider rootless containers |
| 160 | +**Device Access**: None |
| 161 | +**Justification**: Development tools should not require elevated privileges |
| 162 | + |
| 163 | +## 🎯 Implementation Roadmap |
| 164 | + |
| 165 | +### Phase 1: Critical Risk Reduction (Week 1) |
| 166 | +- [ ] Remove SYS_ADMIN from Filebrowser |
| 167 | +- [ ] Remove SYS_ADMIN from Radarr, Sonarr, Bazarr |
| 168 | +- [ ] Fix Arpspoof privilege types |
| 169 | +- [ ] Test functionality with reduced privileges |
| 170 | + |
| 171 | +### Phase 2: Systematic Review (Week 2-3) |
| 172 | +- [ ] Review all 57 SYS_ADMIN usage instances |
| 173 | +- [ ] Create privilege justification documentation for each |
| 174 | +- [ ] Implement alternatives for 80% of cases |
| 175 | + |
| 176 | +### Phase 3: Documentation & Prevention (Week 4) |
| 177 | +- [ ] Update CONTRIBUTING.md with privilege guidelines |
| 178 | +- [ ] Add privilege justification requirements to PR template |
| 179 | +- [ ] Implement automated privilege checking in CI/CD |
| 180 | + |
| 181 | +## 📈 Success Metrics |
| 182 | + |
| 183 | +- **Target**: Reduce SYS_ADMIN usage from 57 to <15 add-ons |
| 184 | +- **Timeline**: 4 weeks |
| 185 | +- **Verification**: Automated testing with reduced privileges |
| 186 | +- **Documentation**: 100% of remaining SYS_ADMIN usage documented and justified |
| 187 | + |
| 188 | +## 🛡️ Security Impact |
| 189 | + |
| 190 | +**Before**: 53% of add-ons with near-root container access |
| 191 | +**After**: <14% of add-ons with justified elevated privileges |
| 192 | +**Risk Reduction**: ~70% reduction in high-privilege containers |
| 193 | +**Attack Surface**: Significantly reduced container escape vectors |
| 194 | + |
| 195 | +--- |
| 196 | + |
| 197 | +**Next Review**: 2025-09-02 (Monitor privilege usage trends and compliance) |
| 198 | + |
| 199 | +*This analysis demonstrates that the majority of SYS_ADMIN usage in this repository is unnecessary and represents a significant security risk that can be mitigated through proper container security practices.* |
0 commit comments