Artificial Intelligence and Cybersecurity: Inteligência Artificial E Cibersegurança (Inacs)
Artificial Intelligence and Cybersecurity: Inteligência Artificial E Cibersegurança (Inacs)
Artificial Intelligence and Cybersecurity: Inteligência Artificial E Cibersegurança (Inacs)
Cybersecurity
INTELIGÊNCIA ARTIFICIAL E CIBERSEGURANÇA (INACS)
N U N A L @ I S E P. I P P. P T
O M S @ I S E P. I P P. P T
Artificial Intelligence in Cybersecurity
• There are multiple possible applications of AI in the Cybersecurity domain…
• In INACS you have been addressing several of them:
• DDoS Detection
• Facial Recognition
• Password Cracking
DDoS Detection
• DDoS are common attacks that can be very disruptive when successful
• It is also a typical example of applied AI to Cybersecurity
• Example:
• The dataset is a subsampling of the CSE-CIC-IDS2018, CICIDS2017, and CIC DoS datasets
(2017). It consists of 80% benign and 20% DDoS traffic, to represent a more realistic ratio of
normal-to-DDoS traffic
DDoS Detection
• Example:
• Read the dataset
• features = [ "Fwd Seg Size Min", "Init Bwd Win Byts", "Init Fwd Win Byts", "Fwd Seg
Size Min", "Fwd Pkt Len Mean", "Fwd Seg Size Avg", "Label", "Timestamp"]
• dtypes = { "Fwd Pkt Len Mean": "float", "Fwd Seg Size Avg": "float", "Init Fwd Win
Byts": "int", "Init Bwd Win Byts": "int", "Fwd Seg Size Min": "int", "Label": "str"}
• date_columns = ["Timestamp"]
• df = pd.read_csv("ddos_dataset.csv", usecols=features,
dtype=dtypes,parse_dates=date_columns, index_col=None)
DDoS Detection
• Example:
• Train/Test split based on time (other approach)
• df2 = df.sort_values("Timestamp")
• df3 = df2.drop(columns=["Timestamp"])
• l = len(df3.index)
• train_df = df3.head(int(l * 0.8))
• test_df = df3.tail(int(l * 0.2))
• Perform search
• matches = face_recognition.compare_faces(unknown_faces, trump_encoding)
• print(matches)
• Ouput:
• [False, False, False, True]
Facial Recognition
• Example with Trump’s face:
• Determine face locations and save the one related to Trump
• face_locations = face_recognition.face_locations(unknown_image)
• trump_face_location = face_locations[3]
• Read the image with cv2 and draw a rectangle on matching face
• unknown_image_cv2 = cv2.imread("trump_and_others.jpg")
• (top, right, bottom, left) = trump_face_location
• cv2.rectangle(unknown_image_cv2, (left, top), (right, bottom), (0, 0, 255), 2)
Facial Recognition
• Example with Trump’s face:
• Label the rectangle
• cv2.rectangle(unknown_image_cv2, (left, bottom - 35), (right, bottom), (0, 0, 255), cv2.FILLED)
• font = cv2.FONT_HERSHEY_DUPLEX
• cv2.putText(unknown_image_cv2, "Trump", (left + 6, bottom - 6), font, 1.0, (255, 255, 255), 1)
• Display image
• cv2.namedWindow('image', cv2.WINDOW_NORMAL)
• cv2.imshow('image’, unknown_image_cv2)
• cv2.waitKey(0)
• cv2.destroyAllWindows()
Facial Recognition
• Example with Trump’s face:
• Behind face_recognition Deep Learning is used to process the images
• Significant performance gains can be achieved using GPUs
• The provided example can be easily automated to perform any image search between a
source and a target image
• Place a dataset under the data folder (e.g., rockyou password dataset).
• curl -L -o data/train.txt
https://github.com/brannondorsey/PassGAN/releases/download/data/rockyou-train.txt
• Train algorithm
• python train.py --output-dir output --training-data data/train.txt
Password Cracking
• Example
• Generate a list of passwords (100,000)
• python sample.py \
• --input-dir pretrained \
• --checkpoint pretrained/checkpoints/195000.ckpt \
• --output gen_passwords.txt \
• --batch-size 1024 \
• --num-samples 100000
Privacy Risks of Artificial Intelligence
• AI is dependent on collecting large blocks of data to learn
• that could lead to
• data privacy issues
• ethical issues
• safety issues
• The volume of data that AI models can sustain is stunning
• without the appropriate safeguards and regulatory guarantees
• AI could pose risks to individual data security and privacy
• Patient data
• Financial data
• …
• There is still a gap in how security and privacy should be regulated in the AI area.
• The first step is to make the solutions based on AI comply with regulations like
• GDPR, HIPAA, ...
Privacy Risks of Artificial Intelligence
• Differential Privacy
• Can help to comply with data privacy regulations
• Help keep the data of individuals
• Safe and
• Private
• Properties of Differential Privacy
• Post-processing
• Differentially private mechanisms are immune to post-processing
• The design of any function with a differentially private mechanism will stay differentially
private
• Composition
• Distinctively private mechanisms are closed under composition.
• Applying multiple mechanisms still results in the overall mechanism being differentially
private
Privacy Risks of Artificial Intelligence
• Homomorphic encryption
• Standard encryption methods do not allow computation on encrypted data
• Method that allows to compute analytical functions on encrypted data ensuring privacy
• Starting with two pieces of data, 𝑎 and 𝑏, the functional outcome should be the same when
following the arrows in either direction, across and then down n (compute-then-encrypt), or
down and then across (encrypt-then-compute): 𝐸(𝑎 + 𝑏) = 𝐸(𝑎) + 𝐸(𝑏).
• Private AI: Machine Learning on Encrypted Data
• https://eprint.iacr.org/2021/324.pdf
Privacy Risks of Artificial Intelligence
• Homomorphic encryption references
• Indistinguishable from an authentic image to human eyes, the poisoned images contain data
that can train the AI/ML to misidentify whole types of items.
• The proliferation of open-source AI/ML tools and data training sets of doubtful origin facilitates
• the software supply-chain attacks
• data poisoning
• https://github.com/Azure/AI-Security-Risk-Assessment/blob/main/AI_Risk_Assessment_v4.1.4.pdf
NIST AI Risk Management Framework
• Draft of the NIST AI Risk Management Framework
• Manage risks associated with AI to:
• Individuals
• Organizations
• Society
• https://www.nist.gov/itl/ai-risk-management-framework
AI Security
• References
• Securing AI - How Traditional Vulnerability Disclosure Must Adapt
• https://cset.georgetown.edu/wp-content/uploads/Securing-AI.pdf
• Attacking Artificial Intelligence AI’s Security Vulnerability and What Policymakers Can Do About It
• https://www.belfercenter.org/sites/default/files/2019-08/AttackingAI/AttackingAI.pdf
• Best practices for AI security risk management
• https://www.microsoft.com/security/blog/2021/12/09/best-practices-for-ai-security-risk-
management/
• Failure Modes in Machine Learning
• https://docs.microsoft.com/en-us/security/engineering/failure-modes-in-machine-learning
• Threat Modeling AI/ML Systems and Dependencies
• https://docs.microsoft.com/en-us/security/engineering/threat-modeling-aiml
• Securing Machine Learning Algorithms
• https://www.enisa.europa.eu/publications/securing-machine-learning-algorithms
AI Security
• References
• Securing Artificial Intelligence (SAI) Problem Statement
• https://www.etsi.org/deliver/etsi_gr/SAI/001_099/004/01.01.01_60/gr_SAI004v010101p.pdf
• Securing Artificial Intelligence (SAI) - AI Threat Ontology
• https://www.etsi.org/deliver/etsi_gr/SAI/001_099/001/01.01.01_60/gr_SAI001v010101p.pdf
• Securing Artificial Intelligence (SAI) - Data Supply Chain Security
• https://www.etsi.org/deliver/etsi_gr/SAI/001_099/002/01.01.01_60/gr_SAI002v010101p.pdf
• Securing Artificial Intelligence (SAI) - Mitigation Strategy Report
• https://www.etsi.org/deliver/etsi_gr/SAI/001_099/005/01.01.01_60/gr_SAI005v010101p.pdf
• Securing Artificial Intelligence (SAI) - The role of hardware in security of AI
• https://www.etsi.org/deliver/etsi_gr/SAI/001_099/006/01.01.01_60/gr_SAI006v010101p.pdf