Chancellor / exchangeMitigationService.ts
VoidBreach's picture
Upload 62 files
35b8b9c verified
Raw History Blame Contribute Delete
2.78 kB
import { ScholasticMitigation, EmergencyMitigationState } from '../types';
class ScholasticEmergencyMitigationService {
private state: EmergencyMitigationState = {
isActive: true,
lastCheck: new Date().toISOString(),
availableMitigations: [],
mitigationsApplied: 0,
ocsConnectivity: 'Connected',
};
private static mitigationsRepo: ScholasticMitigation[] = [
{
id: 'MIT-2024-001',
name: 'ProxyLogon Top-Layer Filter',
description:
'Applies IIS Rewrite rules to block known SSRF patterns on the Exchange Substrate.',
type: 'IIS_REWRITE',
isApplied: false,
severity: 'Critical',
cveCodes: ['CVE-2021-26855'],
},
{
id: 'MIT-2024-002',
name: 'Remote Code Execution Circuit Breaker',
description: 'Disables vulnerable PowerShell endpoints for accounts below SCHOLAR tier.',
type: 'SERVICE_STOP',
isApplied: false,
severity: 'Important',
cveCodes: ['CVE-2021-27065'],
},
{
id: 'MIT-2024-003',
name: 'OAB Privilege De-escalation',
description:
'Modifies registry keys to prevent unauthorized write access to the Offline Address Book (OAB) store.',
type: 'REGISTRY_KEY',
isApplied: false,
severity: 'Moderate',
cveCodes: ['CVE-2021-26858'],
},
];
public async checkForMitigations(): Promise<EmergencyMitigationState> {
console.log('[SEMS] Querying Chancellor Configuration Substrate (CCS)...');
// Simulate network latency
await new Promise((resolve) => setTimeout(resolve, 1500));
this.state.lastCheck = new Date().toISOString();
this.state.availableMitigations = [...ScholasticEmergencyMitigationService.mitigationsRepo];
this.state.ocsConnectivity = 'Connected';
return { ...this.state };
}
public async applyMitigation(id: string): Promise<EmergencyMitigationState> {
console.log(`[SEMS] Applying mitigation: ${id}`);
await new Promise((resolve) => setTimeout(resolve, 800));
const index = this.state.availableMitigations.findIndex((m) => m.id === id);
if (index !== -1) {
this.state.availableMitigations[index] = {
...this.state.availableMitigations[index],
isApplied: true,
appliedAt: new Date().toISOString(),
};
this.state.mitigationsApplied++;
}
return { ...this.state };
}
public async sendDiagnosticData(): Promise<boolean> {
console.log('[SEMS] Packaging diagnostic telemetry for the OCS backchannel...');
await new Promise((resolve) => setTimeout(resolve, 1000));
return true;
}
public getState(): EmergencyMitigationState {
return { ...this.state };
}
}
export const scholasticMitigationService = new ScholasticEmergencyMitigationService();