Threat Model for dIKta.me V2

Threat Model for dIKta.me V2

1. Assets

  1. User Data

    • Voice recordings (temporary in memory, possibly saved to file if feature enabled)
    • Transcribed text (stored in history database, logs, notes)
    • User settings (including API keys stored encrypted)
    • Notes (saved to markdown files)
    • Clipboard content (temporary)
  2. Application Integrity

    • Application binaries and configuration
    • Secure storage of API keys
  3. Privacy

    • User's voice and transcribed content
    • Personal information in transcripts (PII)

2. Threat Actors

  1. Local Malicious User

    • Has physical or logical access to the machine
    • Can run processes, read files, etc.
  2. Malicious Website

    • Can trigger deep links (diktame://) via browser
    • Can attempt CSRF attacks
  3. Malware

    • Can run on the user's machine
    • Can attempt to steal API keys, logs, etc.
  4. Network Attacker

    • Can intercept network traffic (if not using HTTPS)
    • Can perform man-in-the-middle attacks
  5. Insider Threat

    • Legitimate user with malicious intent
    • Can abuse their access

3. Threat Matrix (STRIDE)

3.1 Desktop Application (DiktaMe.App)

Threat TypeDescriptionImpactMitigation
SpoofingAttacker attempts to impersonate the application or user via deep linksMediumValidate JWT format, use state parameter for CSRF, rate limit deep links
TamperingAttacker modifies application binaries or configurationHighCode signing, secure boot, integrity checks (not currently implemented)
RepudiationUser denies performing an action; lack of non-repudiationLowAudit logs (history database) but not cryptographically signed
Information DisclosureAttacker accesses sensitive data (API keys, transcripts, notes)HighDPAPI encryption for API keys, PII scrubbing in logs, access controls on files
Denial of ServiceAttacker makes application unavailable (e.g., via deep link flooding)MediumRate limiting on deep links, input validation
Elevation of PrivilegeAttacker gains higher privileges than intendedLowApplication runs with standard user privileges, no admin elevation

3.2 Secure Storage (DiktaMe.Core.Security.SecureStorage)

Threat TypeDescriptionImpactMitigation
SpoofingN/A--
TamperingAttacker modifies the encrypted keys fileMediumDPAPI provides integrity protection; tampering will cause decryption failure
RepudiationN/A--
Information DisclosureAttacker decrypts and steals API keysHighDPAPI encryption tied to user and machine; keys cannot be decrypted on another machine
Denial of ServiceAttacker deletes or corrupts keys fileMediumApplication handles missing keys gracefully; user can re-enter keys
Elevation of PrivilegeN/A--

3.3 Pipeline Modules (RefinePipeline, ChatPipeline, AskPipeline)

Threat TypeDescriptionImpactMitigation
SpoofingN/A--
TamperingAttacker modifies pipeline codeHighCode integrity (same as application)
RepudiationN/A--
Information DisclosurePII logged in plaintext (historical issue)HighPII scrubbing now implemented in LogUserText methods
Denial of ServiceAttacker causes pipeline to hang or crashLowException handling, timeouts on external calls
Elevation of PrivilegeN/A--

3.4 NoteWriter (DiktaMe.Core.Data.NoteWriter)

Threat TypeDescriptionImpactMitigation
SpoofingN/A--
TamperingAttacker modifies note filesMediumUser controls file location; no integrity protection on notes
RepudiationN/A--
Information DisclosurePath traversal allows writing/reading outside intended directoriesHighPath validation restricts to Documents and AppData\DiktaMe
Denial of ServiceAttacker fills disk with large notesLowUser-controlled; application does not limit note size
Elevation of PrivilegeN/A--

3.5 Deep Link Handler (App.xaml.cs)

Threat TypeDescriptionImpactMitigation
SpoofingAttacker forges deep link to impersonate legitimate callbackHighJWT format validation, state parameter for CSRF
TamperingAttacker modifies deep link URI in transitMediumHTTPS not applicable for custom scheme; relies on URI validation
RepudiationUser denies initiating authenticationLowState parameter ties request to session
Information DisclosureAttacker steals JWT via logs or interceptionMediumJWT not logged; short-lived; HTTPS for token exchange
Denial of ServiceAttacker floods application with deep linksMediumRate limiting (2 second cooldown)
Elevation of PrivilegeN/A--

3.6 Logging (Serilog)

Threat TypeDescriptionImpactMitigation
SpoofingN/A--
TamperingAttacker modifies log filesLowLogs are append-only; no integrity protection
RepudiationN/A--
Information DisclosurePII in logs (historical issue)HighPII scrubbing implemented; logs retained only 7 days
Denial of ServiceAttacker fills disk with logsLowLog rotation (7-day retention)
Elevation of PrivilegeN/A--

3.7 History Database (SQLite)

Threat TypeDescriptionImpactMitigation
SpoofingN/A--
TamperingAttacker modifies history databaseMediumNo integrity protection; user owns the file
RepudiationN/A--
Information DisclosureSensitive data in history database (transcripts)HighData stored per privacy level; PII scrubbing optional; user can delete
Denial of ServiceAttacker corrupts or deletes databaseMediumApplication handles missing database gracefully
Elevation of PrivilegeN/A--

4. Mitigations Summary

  • Secrets Management: API keys encrypted with DPAPI, not stored in plaintext.
  • Input Validation: Deep link tokens validated for JWT format; file paths validated for traversal.
  • Output Encoding: PII scrubbing applied to logs and potentially other outputs based on privacy level.
  • Authentication and Authorization: Deep link uses JWT with state parameter for CSRF protection.
  • Communication Security: All HTTP communication uses HTTPS.
  • Privacy Controls: Four privacy levels allow user to control data retention and PII handling.
  • Audit and Logging: Security-relevant events logged (deep link failures, validation errors).
  • Secure Defaults: Application runs with standard user privileges; no admin elevation required.

5. Threat Modeling Notes

  • The application is a desktop application with a significant attack surface being the local machine.
  • The most critical threats involve information disclosure of sensitive data (API keys, transcripts).
  • Mitigations are in place for the most critical issues identified in past audits (PII logging, path traversal, deep link validation).
  • Continuous monitoring and regular security reviews are recommended.