File size: 6,656 Bytes
f3e7b1b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d9789e9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
---
language:
  - en
tags:
  - cybersecurity
  - psychology
  - classification
  - social-engineering
  - synthetic-data
  - human-factors
  - security
license: mit
datasets:
  - cpf-synthetic-phishing
  - cybersecurity-psychology
metrics:
  - accuracy
  - f1
  - precision
  - recall
library_name: transformers
pipeline_tag: text-classification
base_model: distilbert-base-uncased
widget:
  - text: "CEO requests: transfer funds now."
  - text: "URGENT: approve this payment immediately."
  - text: "Team meeting scheduled for tomorrow."
---

# CPF Demo - Cybersecurity Psychology Framework

A live demonstration of the **Cybersecurity Psychology Framework (CPF)** for detecting psychological vulnerabilities in text communications.

# **Framework Info:** [cpf3.org](https://cpf3.org)

## What is This?

This interactive demo uses a small language model to analyze text messages and identify potential social engineering patterns based on psychological manipulation techniques. The system classifies text into three risk levels and provides explanations for its decisions.

## How to Use

### Basic Usage
1. **Enter text** in the input field (email content, message, etc.)
2. **Click "Submit"** to analyze the text
3. **Review the JSON output** containing:
   - `vulnerability`: CPF indicator ID (0-2)
   - `severity`: Risk level (green/yellow/red)
   - `confidence`: Model certainty (0-1)
   - `explanation`: Brief description

### Example Inputs to Try

**High Risk Examples:**
- "CEO requests: transfer funds now."
- "Your manager demands immediate access to the system."
- "Urgent: approve this payment or we lose the client."

**Medium Risk Examples:**
- "Time-sensitive request - please respond ASAP."
- "Quick favor needed before end of day."

**Low Risk Examples:**
- "Team meeting scheduled for tomorrow at 2 PM."
- "Please review the quarterly report when convenient."
- "Thanks for your help with the project."

## Understanding the Output

### Risk Levels
- 🟢 **Green (Low Risk)**: Normal communication, no manipulation detected
- 🟡 **Yellow (Medium Risk)**: Some pressure indicators present
- 🔴 **Red (High Risk)**: Strong social engineering patterns detected

### CPF Indicators
- **Indicator 0**: General communication patterns
- **Indicator 1**: Authority compliance exploitation
- **Indicator 2**: Temporal pressure and urgency manipulation

### Confidence Scores
- **0.0-0.4**: Low confidence - uncertain classification
- **0.4-0.7**: Moderate confidence - likely accurate
- **0.7-1.0**: High confidence - strong signal detected

## Technical Details

### Model Information
- **Base Model**: [CPF3-org/cpf-poc-model](https://huggingface.co/CPF3-org/cpf-poc-model)
- **Architecture**: DistilBERT-base-uncased fine-tuned for classification
- **Training**: 3 epochs on synthetic CPF indicator data
- **Performance**: ~85% accuracy on validation set

### Privacy Features
- **Differential Privacy**: Gaussian noise (ε=0.8) added to confidence scores
- **No Data Storage**: Input text is not logged or stored
- **Local Processing**: Analysis happens in real-time without data persistence

### Implementation
- **Framework**: Gradio for the web interface
- **Backend**: Hugging Face Transformers pipeline
- **Deployment**: Hugging Face Spaces (CPU)

## Research Context

### The CPF Framework
The Cybersecurity Psychology Framework analyzes human psychological vulnerabilities across 10 categories and 100+ indicators. This demo implements a simplified version focusing on three primary vulnerability patterns:

1. **Authority Compliance**: Exploitation of hierarchical relationships
2. **Temporal Pressure**: Creation of artificial urgency
3. **Reciprocity**: Manipulation through perceived obligations

### Academic Foundation
- Integrates psychoanalytic and cognitive behavioral theories
- Addresses the 85% of security breaches caused by human factors
- Published research available on SSRN

## Limitations and Disclaimers

**Important Limitations:**
- **Proof of Concept Only**: Not suitable for production security monitoring
- **Synthetic Training Data**: May not generalize to all real-world communications  
- **English Only**: Currently supports English language text only
- **Context Length**: Limited to 128 tokens per analysis
- **False Positives**: May flag legitimate urgent communications

**Ethical Considerations:**
- This tool should not be used to monitor personal communications without consent
- Human oversight is required for any security decisions
- Results should be used for educational and research purposes

## Related Resources

**Model Repository**: [CPF3-org/cpf-poc-model](https://huggingface.co/CPF3-org/cpf-poc-model)  
**Implementation Guide**: [Colab Notebook](https://colab.research.google.com/drive/1fUpjTILbM_1wX7aEGeb0X-uomKlqj0OL)  
**CPF Framework**: [cpf3.org](https://cpf3.org)  
**Source Code**: [GitHub Repository](https://github.com/xbeat/CPF)  
**Technical Paper**: [Implementation Guide](https://github.com/xbeat/CPF/blob/main/AI/)

## API Integration

For programmatic access, use the Hugging Face Inference API:

```python
import requests

API_URL = "https://api-inference.huggingface.co/models/CPF3-org/cpf-poc-model"
headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}

def query(payload):
    response = requests.post(API_URL, headers=headers, json=payload)
    return response.json()

result = query({"inputs": "CEO requests: transfer funds now."})
print(result)
```

## Development

### Local Setup
```bash
git clone https://huggingface.co/spaces/CPF3-org/cpf-poc-demo
cd cpf-poc-demo
pip install -r requirements.txt
python app.py
```

### Dependencies
- `torch`: PyTorch framework
- `transformers`: Hugging Face model pipeline
- `gradio`: Web interface framework

## Feedback and Support

**Found an issue or have suggestions?**
- Open an issue on [GitHub](https://github.com/xbeat/CPF/issues)
- Contact the author: kaolay@gmail.com

**For Academic Collaboration:**
- ORCID: [0009-0007-3263-6897](https://orcid.org/0009-0007-3263-6897)
- Research interests: Cybersecurity psychology, human factors security

## Citation

If you use this demo in your research or presentations:

```bibtex
@misc{canale2025cpfdemo,
  title={CPF Demo - Cybersecurity Psychology Framework},
  author={Giuseppe Canale},
  year={2025},
  publisher={Hugging Face Spaces},
  howpublished={\url{https://huggingface.co/spaces/CPF3-org/cpf-poc-demo}}
}
```

## License

MIT License - See LICENSE file for details.

---

**Disclaimer**: This is a research prototype for educational and demonstration purposes. Not intended for production security monitoring without proper validation and human oversight.