-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLLM Eco
546 lines (356 loc) · 24.8 KB
/
LLM Eco
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
<p style="color: red; font-weight: bold">>>>>> gd2md-html alert: ERRORs: 0; WARNINGs: 1; ALERTS: 0.</p>
<ul style="color: red; font-weight: bold"><li>See top comment block for details on ERRORs and WARNINGs. <li>In the converted Markdown or HTML, search for inline alerts that start with >>>>> gd2md-html alert: for specific instances that need correction.</ul>
<p style="color: red; font-weight: bold">Links to alert messages:</p>
<p style="color: red; font-weight: bold">>>>>> PLEASE check and correct alert issues and delete this message and the inline alerts.<hr></p>
# LLM AI Cybersecurity Open Source Ecosystem Guide
##
** ****From the OWASP Top 10 for LLM Applications Team**
**Version: 0.1 \
Published: Target: Mid-March 2024**
Revision History
<table>
<tr>
<td><strong>Revision</strong>
</td>
<td><strong>Date</strong>
</td>
<td><strong>Authors</strong>
</td>
<td><strong>Description</strong>
</td>
</tr>
<tr>
<td>.1
</td>
<td>3/3/2024
</td>
<td>Scott Clinton
</td>
<td>Initial Draft
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
The information provided in this document does not, and is not intended to, constitute legal advice. All information is for general informational purposes only. This document contains links to other third-party websites. Such links are only for convenience and OWASP does not recommend or endorse the contents of the third-party sites.
**Contents**
[TOC]
# Overview and Definitions
## Objectives
As organizations face the challenges of how to secure against the threats presented by LLMs and Generative AI, there are both solutions Today that can be leveraged in support of both laying the foundation for securing companies to address the LLM Top 10 vulnerabilities as well as solutions that need to be developed to create close the gaps on new vectors of attack not previously considered.
The objective of this document is to provide CISOs and Security analysts with insights into Open Source, Commercial and Emerging Solutions to address these areas.
This document is not to be considered a complete list, nor is it a recommendation of one solution over another. It is intended to provide as up-to-date a list as the community can provide as an educational tool for organizations to begin to put processes and technologies in place to secure their applications.
## LLM and Gen AI Lifecycle Categories
For the purposes of categorizing security solutions and their applicability both across the LLM and Generative AI Solutions we have created the following categories map, and descriptions that at this point in time best align to the application development, provisioning and usage patterns.
<table>
<tr>
<td>Model Lifecycle Stages
</td>
<td colspan="2" >Security Solution / Control Categories
</td>
</tr>
<tr>
<td><em>Consumption</em>
</td>
<td>Continuous Red Teaming
<p>
Detection and Response
<p>
Data Leak Protection
</td>
<td>
</td>
</tr>
<tr>
<td><em>Observability/Monitoring</em>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td><em>Serving and Deployment</em>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td><em>Building</em>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td><em>Data Preparation</em>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
### Data Preparation
The process of data model preparation for Large Language Models (LLMs) and generative AI involves several critical steps, ensuring the model is trained on high-quality, diverse, and relevant datasets. This preparation is vital for the model's ability to generate accurate, coherent, and contextually appropriate responses. Here's a comprehensive description of the process:
* <span style="text-decoration:underline;">Data Collection:</span> Gather a broad and diverse range of text data from various sources to cover numerous topics, styles, and languages.
* <span style="text-decoration:underline;">Data Cleaning and Preprocessing</span>: Remove irrelevant content, correct errors, standardize formats, and eliminate personally identifiable information to protect privacy.
* <span style="text-decoration:underline;">Data Annotation:</span> For specific tasks, label the data to describe features or answers, using manual, semi-automatic, or automatic methods.
* <span style="text-decoration:underline;">Data Augmentation:</span> Increase dataset diversity without collecting more data through techniques like paraphrasing, translating, or using generative models to create new data.
* <span style="text-decoration:underline;">Dataset Splitting:</span> Divide the dataset into training, validation, and testing sets to train the model, tune hyperparameters, and evaluate performance on unseen data.
* <span style="text-decoration:underline;">Feature Extraction and Tokenization:</span> Convert text into a model-understandable format by splitting it into tokens and extracting features, preparing it for learning.
* <span style="text-decoration:underline;">Training Data Preparation</span>: Organize the processed data into batches and sequences suitable for the model, ensuring compatibility with the model architecture.
* <span style="text-decoration:underline;">Ethical Considerations and Bias Mitigation:</span> Address ethical concerns and mitigate biases by ensuring data diversity, fairness, and avoiding propagation of stereotypes or misinformation.
#### Security Controls and Solutions Specific to Data Preparation
Securing the data preparation process for models, especially Large Language Models (LLMs) and generative AI, involves implementing a variety of tools and controls. These measures are crucial for protecting the data from unauthorized access, ensuring data integrity, and complying with legal and ethical standards. Here’s a list categorized into tools and control categories:
* <span style="text-decoration:underline;">Data Masking and Anonymization:</span> Used to remove or obfuscate personally identifiable information (PII) to protect privacy.
* <span style="text-decoration:underline;">Encryption: </span>Ensure data at rest and in transit is encrypted, protecting it from interception or unauthorized access.
* <span style="text-decoration:underline;">Access Control:</span> Limit data access to authorized personnel only, based on their roles and the principle of least privilege.
* <span style="text-decoration:underline;">Data Loss Prevention (DLP) Software</span>: Prevent sensitive data from being leaked or misused.
* Secure Data Storage Solutions: Protect data storage with encryption, access controls, and regular security audits.
* <span style="text-decoration:underline;">Data Audit and Logging:</span> Track data access and modifications, providing an audit trail for accountability and investigation.
* Data Privacy Controls: Ensure compliance with data protection regulations (like GDPR, CCPA) through anonymization, pseudonymization, and consent management.
* <span style="text-decoration:underline;">Data Integrity Controls:</span> Mechanisms to ensure the accuracy and consistency of data throughout its lifecycle, including checksums and validation processes.
* <span style="text-decoration:underline;">Network Security Controls:</span> Safeguard the network infrastructure with firewalls, VPNs, and intrusion detection/prevention systems to prevent unauthorized data access or transfer.
* <span style="text-decoration:underline;">Compliance and Governance Controls:</span> Policies and procedures that guide data handling practices, ensuring adherence to legal, ethical, and industry standards.
### Building
The model building process for Large Language Models (LLMs) and generative AI involves several sequential steps, starting from the initial design to the final training and validation stages. Here’s a brief overview of this process:
* Design and Architecture: Defining the model's structure, including the type of neural network, layers, and activation functions, to meet the specified goals.
* Data Preparation: Collecting, cleaning, and preprocessing data to create a training dataset that's representative of the problem domain.
* Model Training: Adjusting the model's parameters (weights and biases) using the training dataset through a process of optimization, often involving gradient descent and backpropagation.
* Evaluation and Validation: Assessing the model's performance on a separate validation dataset to tune hyperparameters and prevent overfitting.
* Testing: Using a testing dataset to evaluate the model's generalization capability to new, unseen data, ensuring it performs well in real-world scenarios.
#### Security Controls and Solutions Specific to Model Building
These security controls are crucial for protecting the integrity of the model building process, ensuring the confidentiality and integrity of the data used, and safeguarding the resulting models from unauthorized access or manipulation.
* Secure Data Storage and Transmission: Ensuring that data used in training and validation is securely stored and transmitted, employing encryption both at rest and in transit.
* Access Control to Training Environments: Limiting access to model training environments to authorized personnel, using role-based access controls (RBAC) and authentication mechanisms.
* Model Integrity Controls: Implementing measures to ensure the integrity of the model during training, such as checksums and digital signatures, to protect against unauthorized modifications.
* Secure Deployment: Ensuring the environment into which the model is deployed is secure, including the use of container security, secure APIs, and monitoring for anomalous behavior that might indicate a security breach.
* Vulnerability Management: Regularly scanning and updating the software and libraries used in the model building process to protect against known vulnerabilities.
### Provisioning and Serving
The model provisioning and serving process involves deploying trained machine learning models so they can be used to make predictions or analyses on new data in a production environment. This process ensures that the model is accessible and performs optimally under real-world operational conditions.
* Model Selection: Choosing the most appropriate model based on performance metrics from the testing phase.
* Environment Setup: Preparing the production environment, which can range from cloud services to on-premises servers, ensuring it meets the required computational needs.
* Model Deployment: Deploying the model to the production environment, making it available for making predictions or analyses on new data.
* Integration: Integrating the model with existing systems, such as web applications or data pipelines, to automate the flow of data in and out of the model.
* Monitoring and Maintenance: Continuously monitoring the model's performance to detect and correct drift, anomalies, or failures, and updating the model as necessary to maintain its accuracy and effectiveness.
#### Security Controls and Solutions Specific to Provisioning and Serving
These security controls are crucial for protecting the integrity of the model building process, ensuring the confidentiality and integrity of the data used, and safeguarding the resulting models from unauthorized access or manipulation.
* Authentication and Authorization: Implementing strong authentication and authorization mechanisms to control access to the model, ensuring that only authorized users or systems can make predictions or access model outputs.
* Data Encryption: Using encryption for data in transit and at rest, protecting sensitive input data sent to the model and the predictions it generates.
* Secure APIs: Ensuring that any APIs used to interact with the model are secured against common web vulnerabilities, such as SQL injection or cross-site scripting (XSS), and implementing rate limiting to prevent abuse.
* Access Logging and Monitoring: Keeping detailed logs of access to the model and monitoring for unusual patterns that might indicate an attempted breach or abuse.
* Model Tampering Protection: Applying measures to prevent unauthorized changes to the model, including digital signatures and checksums.
* Network Security: Using firewalls, virtual private clouds (VPCs), and other network security measures to isolate the model and protect it from external attacks.
* Data Privacy Compliance: Adhering to data privacy regulations and best practices when handling input data and generating outputs, especially when personal or sensitive information is involved.
* Regular Security Audits: Conducting regular security audits of the model serving environment to identify and remediate potential vulnerabilities.
### Observability/Monitoring
The model monitoring and serving process is crucial for maintaining the performance and reliability of machine learning models once they are deployed in production. This process ensures that the models continue to operate as expected over time, providing accurate predictions or analyses even as input data changes. Below is a concise overview of this process, followed by specific security controls pertinent to model monitoring and serving:
* <span style="text-decoration:underline;">Model Serving:</span> Deploying the model in a production environment where it can receive input data and return predictions or analyses. This includes setting up scalable and accessible infrastructure to handle requests efficiently.
* <span style="text-decoration:underline;">Performance Monitoring:</span> Continuously tracking the model's performance metrics to identify any degradation or deviations from expected behavior, such as accuracy, latency, and throughput.
* <span style="text-decoration:underline;">Data Quality Monitoring:</span> Observing the quality of input data to detect any anomalies, shifts in data distribution, or new patterns that could affect the model's accuracy.
* <span style="text-decoration:underline;">Operational Monitoring</span>: Ensuring the infrastructure supporting the model operates smoothly, monitoring for issues like server downtime, high latency, or resource bottlenecks.
* <span style="text-decoration:underline;">Feedback Loops</span>: Implementing mechanisms for collecting feedback on the model's predictions, which can be used to further refine and improve the model.
* <span style="text-decoration:underline;">Update and Retraining:</span> Regularly updating the model with new data or retraining it to adapt to changes in data patterns, ensuring sustained performance over time.
#### Security Controls and Solutions Specific to Provisioning and Serving
These security controls are crucial for protecting the integrity of the model building process, ensuring the confidentiality and integrity of the data used, and safeguarding the resulting models from unauthorized access or manipulation.
* Secure Model Access: Employing authentication and authorization to restrict access to the model, ensuring that only authorized users or systems can use it or access its predictions.
* Input and Output Data Encryption: Protecting the confidentiality and integrity of input data and model predictions with encryption, both in transit and at rest.
* API Security: Securing APIs that provide access to the model, implementing measures against attacks such as injection and ensuring that API keys or tokens are managed securely.
* Access and Activity Logging: Keeping detailed logs of all access to the model and its predictions, and monitoring these logs for signs of unauthorized or malicious activity.
* Anomaly Detection: Using anomaly detection systems to monitor for unusual activity that could indicate a security threat, such as attempts to probe the model for vulnerabilities or to extract sensitive data.
* Network Isolation and Protection: Isolating the model serving environment using network security measures like firewalls, VPNs, and private clouds to reduce exposure to potential attacks.
* Data Privacy Measures: Implementing strict data privacy controls to protect sensitive information, adhering to relevant data protection regulations and best practices.
* Regular Security Assessments: Conducting regular security assessments of the model serving and monitoring infrastructure to identify and mitigate potential vulnerabilities.
### Consumption
Model consumption and usage refer to the process where deployed machine learning models are utilized by end-users or applications to make predictions, analyze data, or generate insights. This final step in the model lifecycle involves interacting with the model through APIs, applications, or other interfaces to apply the model's capabilities to real-world problems and data. Ensuring secure and efficient access to the model's functionalities is crucial for maintaining data integrity, user privacy, and system reliability.
* Accessing the Model: Users or applications access the model through APIs, web interfaces, or direct integration into software applications, requesting predictions or analyses based on input data.
* Receiving Predictions: The model processes the input data and returns predictions, analyses, or insights, which can be used to inform decisions, automate processes, or enhance user experiences.
* Interpreting Results: Users or applications interpret the model's output, integrating these insights into broader decision-making processes, workflows, or user interfaces.
* Feedback and Improvement: Feedback on the model's predictions may be collected for future improvements, either to refine the model itself or to adjust how its outputs are used.
#### Security Controls and Solutions Specific to Model Consumption
By implementing these security controls, organizations can ensure that the consumption and usage of machine learning models are secure, protecting both the integrity of the model and the privacy and security of user data. This approach fosters trust and reliability in AI systems, enabling their effective use in a wide range of applications.
* <span style="text-decoration:underline;">Authentication and Access Control:</span> Implement strong authentication mechanisms and fine-grained access controls to ensure that only authorized users or systems can access the model and its predictions.
* <span style="text-decoration:underline;">Data Encryption:</span> Encrypt sensitive input data sent to the model and the predictions returned to the user, both in transit and at rest, to protect against data breaches and eavesdropping.
* <span style="text-decoration:underline;">LLM Firewalls:</span> act as a security layer to monitor and control the input/output data flow to and from an LLM, ensuring only appropriate content is processed or generated. They can prevent malicious inputs designed to exploit the model or elicit unauthorized data, using predefined rules or dynamic analysis to detect and block potential threats.
* <span style="text-decoration:underline;">Secure API Usage:</span> Secure the APIs through which the model is accessed, using HTTPS, API keys, and tokens to safeguard against unauthorized access and ensure data integrity.
* <span style="text-decoration:underline;">Rate Limiting and Throttling:</span> Implement rate limiting and throttling on model access to prevent abuse and ensure the model remains available to legitimate users.
* <span style="text-decoration:underline;">Input Validation</span>: Validate input data to prevent injection attacks or attempts to probe the model with malicious data, ensuring that only legitimate requests are processed.
* <span style="text-decoration:underline;">Anomaly Detection</span>: Continuously monitor access patterns and model usage for signs of unusual or unauthorized activity, employing anomaly detection systems to identify potential security threats.
* <span style="text-decoration:underline;">Data Privacy Compliance:</span> Adhere to data privacy laws and regulations, ensuring that user data is handled securely and ethically, with mechanisms for consent management and data anonymization where necessary.
* <span style="text-decoration:underline;">User Education and Awareness</span>: Educate users about secure model usage practices, including the importance of safeguarding sensitive data and understanding the model's limitations and potential biases.
*
# OWASP LLM CyberSecurity Open Source
# Ecosystem Map
#
# LLM Cybersecurity Category Definitions
As part of this section we will outline both the collusion categories, such as LLM Firewalls, LLM Observability etc and their role in improving the overall security posture of your LLM development pipeline and production applications.
## Governance
### AI Firewalls
LLM Firewalls act as a security layer to monitor and control the input/output data flow to and from an LLM, ensuring only appropriate content is processed or generated. They can prevent
malicious inputs designed to exploit the model or elicit unauthorized data, using predefined rules or dynamic analysis to detect and block potential threats.
### Observability
LLM Observability tools provide insights into the performance and behavior of LLMs in real-time, offering metrics, logs, and traces. These tools are crucial for monitoring model health, detecting anomalies in model behavior, understanding the impact of inputs on outputs, and identifying \
potential security breaches or misuse of the model.
### Data Protection and Privacy
Tools in this category focus on safeguarding the data used for training and interacting with LLMs. They include encryption tools for data at rest and in transit, anonymization tools to remove personally identifiable information, and data access control systems to ensure only authorized individuals can access sensitive information.
### New Title
These tools are designed to help organizations monitor and enforce compliance with ethical standards, legal regulations, and internal policies. They can automatically audit LLM outputs and inputs, ensuring adherence to guidelines related to fairness, privacy, copyright, and more, and can facilitate reporting and remediation processes.
### Guardrails
Guardrails are predefined policies or constraints implemented within or alongside LLMs to ensure the models operate within ethical, legal, and safety boundaries. They help in mitigating biases, preventing the generation of harmful content, and ensuring compliance with regulatory requirements by automatically filtering or modifying outputs or inputs.
###
Ethical and Compliance
###
Monitoring
These tools are designed to help organizations monitor and enforce compliance with ethical standards, legal regulations, and internal policies. They can automatically audit LLM outputs and inputs, ensuring adherence to guidelines related to fairness, privacy, copyright, and more, and can facilitate reporting and remediation processes.
## Model Consumption
### Continuous Red Teaming
### Detection and Response
### Data Leak Protection
## Model Building & Serving
###
Federated Learning
###
Vulnerability Scanning and Monitoring
###
PII Identification
###
Synthetic Data Generation
## Ethical Compliance and Monitoring
# Top 10 for LLM Solutions Mapping
Companies and tools are listed alphabetically. This is not an endorsement of one company or tool over another, nor an exhaustive list
**LLM Observability**
<table>
<tr>
<td><strong>Company, Tool Name</strong>
</td>
<td><strong>Description</strong>
</td>
<td><strong>Open, Closed \
Source</strong>
</td>
<td><strong>Top 10 For LLM Coverage</strong>
</td>
</tr>
<tr>
<td>Exabeam, Security Analytics
</td>
<td>Exabeam Security Analytics uses machine learning for threat detection, automating responses, and streamlining security operations.
</td>
<td>Closed
</td>
<td>LLM01, LLM04
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
**LLM Observability**
<table>
<tr>
<td><strong>Company, Tool Name</strong>
</td>
<td><strong>Description</strong>
</td>
<td><strong>Open, Closed \
Source</strong>
</td>
<td><strong>Top 10 For LLM Coverage</strong>
</td>
</tr>
<tr>
<td>Exabeam, Security Analytics
</td>
<td>Exabeam Security Analytics uses machine learning for threat detection, automating responses, and streamlining security operations.
</td>
<td>Closed
</td>
<td>LLM01, LLM04
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
#
# Contributors
#
# Corporate Supporters and Contributors
## Corporate Supporters
## Corporate Contributors