AI & Cybersecurity for Teens

A curricular activity sequence integrating AI and Cybersecurity for High School

(Wondering why AI+Cybersecurity? or Looking for a concept map?)

Activity 0: Intro to NetsBlox, RPCs and Simple Chat App

Estimated Duration 2 periods (45 minutes)
Lesson Summary In this lesson, students will be introduced to NetsBlox, specifically the messaging blocks to create a ‘simple chat app’ (which will be extended in subsequent projects).
Learning Objectives Students will:
  • learn about NetsBlox, and its key abstractions for RPCs (Call block) and messaging (Send/Receive Message).
Vocabulary Distributed Computing; Remote Procedure Calls; Message Passing
Activities
Student Resources
Teacher Resources
Additional Resources

Activity 1: Cryptography & Coding a Caesar Cipher

Estimated Duration 1 class period (45 minutes)
Lesson Summary In this lesson, students will look at the historical significance of the Caesar Cipher and learn how to implement the shift-cipher using both paper/pencil and NetsBlox.
Learning Objectives Students will:
  • learn about a simple shift-cipher
  • encrypt/decrypt messages using paper and pencil
  • implement shift cipher in NetsBlox
Vocabulary Cipher; Encrypt; Decrypt; Plaintext; Ciphertext
Cybersecurity Concepts/Topics Encryption; Obfuscation of information
Activities
  • Introduction to encryption & historical context of Caesar Cipher
  • Paper/Pencil implementation of Caesar Cipher
  • Netsblox implementation of Caesar Shift Cipher
Real-World "Hook"/Issue
  • Data Encryption & Privacy
Discussion Questions
  • What data needs to be encrypted?
  • What are the downsides of encrypting data?
  • How many possible keys are possible with a Caesar Shift Cipher?
Unplugged/Other Pre-activity
Student Resources
Teacher Resources
Additional Resources

Activity 2: Intro to Chat App

Estimated Duration 2 class periods (45-50 minutes each). One for chat app and one for encryption/decryption of messages.
Lesson Summary In this lesson, students are introduced to the message passing functionality of NetsBlox to create a simple chat app. (The app is extended in subsequent projects to address additional topics in this curriculum).
Learning Objectives Students will:
  • Be introduced to the message creation and message send/receive blocks in NetsBlox
  • Create a simple message passing application in NetsBlox
  • Encrypt/decrypt messages sent to each other
Vocabulary Message passing; Encrypt; Decrypt; Address; Role
Cybersecurity Concepts/Topics Encryption
Activities
  • Code-along a Simple Chat App (starts at 40 minute mark)
  • Incorporate encryption functionality from the Caesar Cipher activity to encrypt/decrypt messages sent to each other
Real-World "Hook"/Issue
  • Messaging is a big part of teen communication. What are the pros/cons?
  • Why are messages in apps like WhatsApp encrypted?
  • Discuss this article: What are the ethical considerations?
Discussion Questions
  • What are some ways in which you communicate with friends? Which is most common?
  • Would you like to keep these chats private and confidential?
  • What are some situations in which such chat should be monitored?
  • What is the fundamental idea behind apps like chat or text?
Student Resources
Teacher Resources

Activity 3: Intro to Network Security/Micro:Bit Activity

Estimated Duration 1 class period (45-50 minutes)
Lesson Summary In this lesson, students will learn about port scanning and network security.
Learning Objectives Students will:
  • learn about scanning for devices on a network
  • explore port scanning
Vocabulary Port Scanning - looking at every possible entry-point into a computer; Firewall - Software tool used to monitor and block ports; Protocol - Set of rules that defines how communication would be sent
Activities
  • Students will need a Micro:bit & Computer. There should also be 2-4 Micro:bits used as “servers” in the class.
  • Micro:bit - Server
  • Micro:bit - Port Scanner
Student Resources
Teacher Resources

Activity 4a: Client-Server Chat App

Estimated Duration 1 class period
Lesson Summary In this lesson, students are introduced to the need and role for a server to moderate and mediate communication via messages. This means we need to create a server app and have client apps communicate through the server.
Learning Objectives Students will:
  • Be introduced to a client-server version of the chat app
  • Understand how a chatroom works and can be created in NetsBlox
  • Understand the role of a server app- to 1) accept connections from client apps, 2) receive their text messages and 3) resend them to every other client. Each user who wants to participate in the Chatroom needs to run a client that 1) connects to the server, 2) sends text messages to it, 3) accepts messages from the server, and 4) displays them on its screen.
Vocabulary Client; Server; Global address; Local address
Cybersecurity Concepts/Topics Message passing; Content moderation; Encryption
Activities
  • Code-along a client-server chat app
  • Extend it to have the server play other roles such as message translation, trying to break messages encrypted using a Caesar Cipher
Discussion Questions
  • How is this chat app different from the first one? Why did we change it?
  • Why do we need to connect to the server?
  • Can we still fool the server so it can't break our encryption?
Student Resources
Teacher Resources
Possible Extensions
  • Translation
  • Color-coding messages based on sender
  • Persistence (show the last 10 messages on first connect)
  • Scrolling
Post Activity Discussion/Reflection

Activity 4b: Denial of Service Attacks (Extending Chat App)

Estimated Duration 1 class period
Lesson Summary In this lesson, students extend the previous chat application to explore denial of service (DoS) attacks.
Learning Objectives Students will:
  • Perform a denial of service attack by overwhelming it with messages
  • Work together to add safeguards to the server to prevent DoS attacks
  • Reflect on approaches and connections to classification and rule-based AI
Vocabulary Denial of Service (DoS); Distributed Denial of Service (DDoS); rate limiting
AI/ML Concepts/Topics Rule-based AI: An AI system that comprises a set of human-coded rules that result in pre-defined outcomes (similar to if-then logic).; Classification
Cybersecurity Concepts/Topics Denial of Service; Distributed Denial of Service
Activities
  • Discuss Denial of Service attacks
  • Discuss how DoS attack can be simulated in the client-server chat app (What will make the server unable to accomplish its role)
  • Students simulate an actual attack on the Chat App server
  • Discuss the ways in which the server can protect itself from such attacks
  • Implement one or more such strategies in student groups
  • End discussion with the idea of a rule-based AI system that can use data to develop an if-then set of rules to mitigate DoS attacks
Discussion Questions
  • Are there any weaknesses to the mitigation techniques you used?
  • What if the user made up new usernames?
  • Could you verify that the user is not a bot?
Student Resources
Teacher Resources
Possible Extensions
  • Add a registration step for users so they have to create an account before sending messages
  • Add a login step where the user needs to provide a password
  • Use a token (such as a big random number) issued on successful login to ensure the user isn't spoofing their username
Post Activity Discussion/Reflection
  • Using examples from real-life, what are the impact/dangers of such attacks? Do you know of any activism-motivated DDoS attacks?
  • Captchas are also one example of how this is mitigated in industry (and related to multi-factor authentication when attempting to login).

Activity 5a: Sentimental Writer App

Estimated Duration 2 periods
Lesson Summary In this lesson, students will learn about classification, and the use of natural language programming and an openly available API (ParallelDots) to classify text.
Learning Objectives Students will:
  • learn about classification through AI/ML.
  • explore classification in NetsBlox through the sentimental “writer” - a basic program that uses an API to classify content (i.e., words/music).
Vocabulary Classification; Natural Language Processing; Sentiment Analysis; Polarity; API
Activities
  • Introduction to NLP and Sentiment Analysis
  • Twitter Sentimental Writer (unplugged movies reviews)
  • Music (song lyrics) Sentiment using Genius API (NetsBlox/View in Python)
Student Resources
Teacher Resources
Possible Extensions
  • Classify music lyrics/NYT articles
Additional Resources

Activity 5b: Intro to Sentiment Analysis & Cyberbullying

Estimated Duration 1 class period
Lesson Summary In this lesson, students will extend the Client-Server Chat app and combine it with the Sentimental Writer to prevent unsavory words and phrases from being sent to others via chat.
Learning Objectives Students will:
  • discuss the issue of online safety and cyberbullying, the impact of harmful language
  • explore how we can use AI to detect and prevent sending hurtful words via chat
AI/ML Concepts/Topics Classification; Sentiment Analysis; Toxic/Abusive language detection; Natural Language Processing
Cybersecurity Concepts/Topics Cyberbullying; Online safety
Activities
  • "Chat App meets Sentimental Writer" - extend the chat app to use the ParallelDots service to determine if we should flag/block text.
Real-World "Hook"/Issue
Discussion Questions
  • What are some of the harms teens and young people face on social media & the internet?
  • Now that we know that we can use AI to classify text as negative or hate speech, or sarcasm, how can we use it to tackle the use of harmful language in cyberspace?
  • How is cyberbullying related to cybersecurity?
  • How do you think apps like “Safe Search” or automated censoring of content (posts/tweets) work?
Student Resources
Teacher Resources
Post Activity Discussion/Reflection

Activity 6: Intro to Machine Learning & Classification

Estimated Duration 1 class period
Lesson Summary In this lesson, students will learn about machine learning as an AI technique and what it means to train a model. They will explore AI applications using pre-trained models available online.
Learning Objectives Students will:
  • learn about machine learning as an AI technique
  • learn about classification and explore what it means to “classify” something using machine learning models
Vocabulary AI; Machine learning; Classification; ML Model; Training a model
Activities
  • Discuss how AI is all-pervasive today
  • Watch ML video/slides (in student resources), discuss
  • Explore one or more AI/ML tools and share
  • Discuss rule-based AI vs ML
Real-World "Hook"/Issue
  • Any big AI/ML example from everyday life including ChatGPT, Netflix, Amazon, etc
Discussion Questions
  • How is rule-based AI different from machine learning?
Student Resources
Teacher Resources
Additional Resources

Activity 7: Data Exploration with CODAP

Estimated Duration 1 class period
Lesson Summary In this lesson, students will learn about data visualization and gain hands-on experience exploring various datasets with CODAP.
Learning Objectives Students will:
  • learn about data distributions
  • learn how to explore data with CODAP
  • learn about periodic data
Vocabulary Distribution; Periodic
Activities
  • Complete CODAP Tutorial (parts 1 & 2)
  • Explore the birthday dataset as a class (answer questions in link)
  • Explore another dataset of interest (from the additional datasets link)!
Discussion Questions
  • Discussion questions can be found in the CODAP links
Student Resources
Teacher Resources

Activity 8: Twitter Bot Detection

Estimated Duration 1 period
Lesson Summary In this lesson, students will create rules to classify (synthetic) Twitter accounts as bots or humans then learn how they can automate this process to learn a decision tree from data.
Learning Objectives Students will:
  • Gain hands-on experience with rule-based AI
  • Learn how rules can be automatically selected to construct a decision tree from data
Vocabulary Classify; Building a decision tree; Entropy; Features
AI/ML Concepts/Topics Decision Tree; Rule-based AI; Entropy
Activities
  • Introduce bot accounts using a real-world hook
  • Decision Tree Unplugged Activity
  • Explore the Twitter dataset using CODAP & create rules to classify accounts
  • Reflect on how we created our rules and how we might automate this
  • Decision tree learning block as Parsons problem
Discussion Questions
  • Does changing the data change the learned tree?
  • How could you make a bot to fool the tree? What features would it need to have?
  • What bot would fool the model and tweet the most?
Unplugged/Other Pre-activity
Student Resources
Teacher Resources
Additional Resources

Activity 9: Registration Bots and Gradient Descent

Estimated Duration 2 class periods
Lesson Summary In this lesson, students will be introduced to optimization, a fundamental concept in machine learning. They will then use gradient descent to optimize a simple bot detection model.
Learning Objectives Students will:
  • Program a bot to register for an account
  • Train an ML model using gradient descent
Vocabulary Optimization; Gradients; Gradient Descent
Activities
  • Introduce registration website activity in NetsBlox
  • Program a bot to register for an account
  • Find the Minimum Game
  • Implement a model for bot classification (Parsons problem)
Student Resources
Teacher Resources
Additional Resources

Activity 10: Adversarial Examples

Estimated Duration 2 periods
Lesson Summary In this lesson, students will learn how they can use what they learned about optimization to optimize points in a way to fool a model. They will also gain hands-on experience creating adversarial examples both in NetsBlox and using another online tool.
Learning Objectives Students will:
  • Apply the concepts they learned around optimization to optimize a point (to fool the model) rather than a model
  • Implement an optimization algorithm for generating adversarial examples
Vocabulary Adversarial examples; Optimization; Model parameters
AI/ML Concepts/Topics Gradient descent; Optimization; Adversarial examples; Classification
Activities
  • Visualize the predictions of the model in the previous activity for many made-up points
  • Discuss what it would mean to move a point toward a minimum or maximum wrt the model predictions
  • Implement an optimization algorithm on a point with the objective of fooling the model
  • Explore an online tool for generating adversarial examples (link below)
Discussion Questions
  • What implications could adversarial examples have for self-driving cars?
  • What would it mean to generate adv. examples for a facial recognition model?
Student Resources
Teacher Resources

Activity 11: Generative Adversarial Networks (GANs)

Estimated Duration 2 class periods
Lesson Summary In this lesson, students will learn about generative adversarial training as they explore the question "Rather than generating a single point, can we train a model to produce realistic looking points?"
Learning Objectives Students will:
  • Use the optimization concepts from a earlier lessons to brainstorm how we could optimize a model to make adversarial examples
  • Implement the training algorithm for a generative model
Vocabulary Generative-Adversarial Networks; Generator; Discriminator
Activities
  • Introduce the Circle GAN project (show the working example)
  • Sketch out the pseudocode for training a model to produce adversarial examples (in the slides)
  • Implement the training algorithm for the generator
  • Train a GAN in the browser using GAN Lab
Discussion Questions
  • Think back to the Find the Minimum game. What would the y-axis represent for the generator? What would the x-axis represent?
  • What would the y-axis represent for the discriminator? What would the x-axis represent?
Student Resources
Teacher Resources
Additional Resources