{"id":28278016,"url":"https://github.com/deviant101/side-channel-attacks-countermeasures","last_synced_at":"2025-06-29T21:41:54.446Z","repository":{"id":288942619,"uuid":"969607354","full_name":"deviant101/side-channel-attacks-countermeasures","owner":"deviant101","description":"Implementation of timing and power analysis side-channel attacks on AES encryption with effective countermeasures and security analysis.","archived":false,"fork":false,"pushed_at":"2025-04-20T16:11:30.000Z","size":578,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-21T07:14:47.875Z","etag":null,"topics":["cryptography","information-security","infosec-project","power-analysis","python","security-analysis","side-channel-attacks","timing-attack"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deviant101.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"docs/security_analysis.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-20T14:37:53.000Z","updated_at":"2025-05-13T08:04:33.000Z","dependencies_parsed_at":"2025-04-21T11:32:06.154Z","dependency_job_id":null,"html_url":"https://github.com/deviant101/side-channel-attacks-countermeasures","commit_stats":null,"previous_names":["deviant101/side-channel-attacks-countermeasures"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/deviant101/side-channel-attacks-countermeasures","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deviant101%2Fside-channel-attacks-countermeasures","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deviant101%2Fside-channel-attacks-countermeasures/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deviant101%2Fside-channel-attacks-countermeasures/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deviant101%2Fside-channel-attacks-countermeasures/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deviant101","download_url":"https://codeload.github.com/deviant101/side-channel-attacks-countermeasures/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deviant101%2Fside-channel-attacks-countermeasures/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260589083,"owners_count":23032828,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptography","information-security","infosec-project","power-analysis","python","security-analysis","side-channel-attacks","timing-attack"],"created_at":"2025-05-21T07:14:17.370Z","updated_at":"2025-06-29T21:41:54.440Z","avatar_url":"https://github.com/deviant101.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Side-Channel Attacks \u0026 Countermeasures\n\nA comprehensive simulation of side-channel attacks on cryptographic implementations, featuring practical demonstrations of timing attacks and power analysis against AES encryption. This project includes robust countermeasures to mitigate vulnerabilities and detailed security impact analysis comparing protected vs vulnerable implementations.\n\n## Project Overview\n\nThis repository contains a semester project for Information Security that implements and analyzes side-channel attacks against cryptographic systems. Side-channel attacks exploit physical implementation characteristics rather than the mathematical security of the cryptographic algorithms themselves.\n\n### Implemented Attacks\n\n1. **Timing Attack**: Demonstrates how variations in execution time can leak information about secret keys\n2. **Power Analysis Attack**: Simulates Differential Power Analysis (DPA) to extract key information from power consumption patterns\n\n### Implemented Countermeasures\n\n1. **Against Timing Attacks**:\n   - Constant-time operations\n   - Time normalization\n   - Random delays\n\n2. **Against Power Analysis**:\n   - Data masking\n   - Power consumption randomization\n   - Operation blinding and shuffling\n\n## Project Structure\n\n```\n/implementation\n├── src/                          # Source code\n│   ├── aes_implementation.py     # Vulnerable AES implementation\n│   ├── timing_attack.py          # Timing attack demonstration\n│   ├── power_analysis.py         # Power analysis attack demonstration\n│   └── countermeasures.py        # Countermeasures implementation\n├── tests/                        # Test cases\n│   ├── test_timing_attack.py     # Tests for timing attack\n│   ├── test_power_analysis.py    # Tests for power analysis attack\n│   └── test_countermeasures.py   # Tests for countermeasure effectiveness\n├── docs/                         # Documentation\n│   ├── security_analysis.md      # Security impact analysis\n│   └── figures/                  # Generated visualizations\n│       ├── timing_attack_visualization.png\n│       ├── power_traces_comparison.png\n│       └── power_analysis_byte_*.png\n└── requirements.txt              # Project dependencies\n```\n\n## Getting Started\n\n### Prerequisites\n\n- Python 3.8+\n- Required Python packages (install via pip):\n  ```\n  pip install -r requirements.txt\n  ```\n\n### Running the Demonstrations\n\n1. **Run the timing attack demonstration**:\n   ```\n   python src/timing_attack.py\n   ```\n\n2. **Run the power analysis attack demonstration**:\n   ```\n   python src/power_analysis.py\n   ```\n\n3. **Run the countermeasures demonstration**:\n   ```\n   python src/countermeasures.py\n   ```\n\n### Running the Tests\n\nTo run all tests:\n```\npython -m unittest discover tests\n```\n\nTo run a specific test:\n```\npython -m unittest tests.test_timing_attack\n```\n\n## Results and Analysis\n\nThe project demonstrates:\n\n1. **Attack Effectiveness**: Side-channel attacks are able to extract cryptographic keys from implementations without exploiting mathematical weaknesses in the algorithm itself\n2. **Countermeasure Impact**: The implemented countermeasures significantly reduce the effectiveness of the attacks\n3. **Security-Performance Trade-offs**: The security benefits of countermeasures come with performance costs\n\nFor detailed analysis, see the [security_analysis.md](docs/security_analysis.md) document.\n\n### Visualizations\n\nThe demonstrations generate visualizations that show:\n\n1. **Timing Attack Results**: Correlation between input values and execution time\n2. **Power Analysis**: Power consumption traces and their correlation with key values\n3. **Countermeasure Effectiveness**: Comparison of vulnerable vs protected implementations\n\nExample visualization:\n\n![Timing Attack Visualization](docs/figures/timing_attack_visualization.png)\n\n## Technical Details\n\n### Vulnerable AES Implementation\n\nThe project includes a deliberately vulnerable AES implementation with:\n- Data-dependent timing characteristics\n- Observable power consumption patterns correlated with processed data\n- No side-channel protections\n\n### Countermeasure Techniques\n\n1. **Constant-time operations**: Ensures cryptographic operations take the same amount of time regardless of data values\n2. **Data masking**: Uses random values to hide the actual data being processed\n3. **Operation blinding**: Adds random factors to prevent attackers from controlling inputs precisely\n4. **Operation shuffling**: Randomly changes operation order to break correlation with power traces\n\n## Academic Context\n\nThis repository is part of an Information Security course project focused on advanced cryptographic implementation security.\n\n## License\n\nThis project is provided for educational purposes only. Use responsibly.\n\n## Acknowledgments\n\n- Based on theoretical foundations from academic papers on side-channel attacks\n- Inspired by real-world security vulnerabilities in cryptographic implementations","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeviant101%2Fside-channel-attacks-countermeasures","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeviant101%2Fside-channel-attacks-countermeasures","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeviant101%2Fside-channel-attacks-countermeasures/lists"}