How pradhyumnak/oauth_flaw_detection works
This repository is a research application for generating OAuth/OIDC flows with deliberate vulnerabilities, detecting them with protocol rules and machine learning, and inspecting flows through a Flask interface. The primary analysis path is captured traces → rule flags and trace features → merged dataset → trained classifiers → hybrid predictions and evaluation. Separately, the web app lets a user browse traces and view generated flow graphs. The README documents a Flask relying party and Keycloak lab; unsampled components are represented only where the README or tree supports them.
Main entry points: traces HTTP Traces · app.py Flask RP · merge_datasets.py Dataset Merge · hybrid_detector.py Hybrid Detector
Components 20
Flow Lab
- Flow Generator
app/flow_generator.py - Keycloak IdP
keycloak - HTTP Traces
app/traces - Dummy Callback
app/dummy_callback.py
Trace Viewer
- Flask RP
app/app.py - Web Views
app/templates - Flow Graphs
app/app.py - Graph Interaction
app/lib/bindings/utils.js
Detection Pipeline
- Rule Detector
app/rule_engine.py - Rule Outputs
app/rule_outputs.csv - Feature Extractor
app/feature_extractor.py - Feature Dataset
app/dataset.csv - Dataset Merge
app/merge_datasets.py - Merged Dataset
app/merged_dataset.csv - Model Training
app/classifier.py - Trained Models
app/models
Model Evaluation
- Hybrid Detector
app/hybrid_detector.py - Evaluation
app/evaluate.py - Outcome Check
app/script.py
Other components
- Analyst
Connections 21
- Flow Generator → Keycloak IdP: sends OAuth flows
README.md - Flow Generator → HTTP Traces: saves traces
app/flow_generator.py - Analyst → Flask RP: browses traces
app/app.py - Flask RP → HTTP Traces: reads traces
app/app.py - Flask RP → Web Views: renders views
app/app.py - Flask RP → Flow Graphs: generates graph
app/app.py - Flow Graphs → Graph Interaction: uses interaction code
- Rule Detector → HTTP Traces: reads traces
app/rule_engine.py - Rule Detector → Rule Outputs: writes flags
app/rule_engine.py - Feature Extractor → HTTP Traces: reads traces
app/feature_extractor.py - Feature Extractor → Feature Dataset: writes features
app/feature_extractor.py - Dataset Merge → Feature Dataset: reads features
app/merge_datasets.py - Dataset Merge → Rule Outputs: reads flags
app/merge_datasets.py - Dataset Merge → Merged Dataset: writes merged data
app/merge_datasets.py - Model Training → Merged Dataset: trains from
app/classifier.py - Model Training → Trained Models: saves models
app/classifier.py - Hybrid Detector → Merged Dataset: loads data
app/hybrid_detector.py - Hybrid Detector → Trained Models: loads models
app/hybrid_detector.py - Evaluation → Hybrid Detector: calls predictions
app/evaluate.py - Evaluation → Trained Models: loads baseline
app/evaluate.py - Outcome Check → HTTP Traces: checks outcomes
app/script.py