<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE FL_Course SYSTEM "https://www.flane.de/dtd/fl_course095.dtd"><?xml-stylesheet type="text/xsl" href="https://portal.flane.ch/css/xml-course.xsl"?><course productid="36420" language="en" source="https://portal.flane.ch/swisscom/en/xml-course/cydrill-crwgaic" lastchanged="2025-10-29T08:41:21+01:00" parent="https://portal.flane.ch/swisscom/en/xml-courses"><title>Code responsibly with generative AI in C# (desktop applications)</title><productcode>CRWGAIC</productcode><vendorcode>CY</vendorcode><vendorname>Cydrill</vendorname><fullproductcode>CY-CRWGAIC</fullproductcode><version>1.0</version><objective>&lt;ul&gt;
&lt;li&gt;Understanding the essentials of responsible AI&lt;/li&gt;&lt;li&gt;Getting familiar with essential cyber security concepts&lt;/li&gt;&lt;li&gt;Input validation approaches and principles&lt;/li&gt;&lt;li&gt;Identify vulnerabilities and their consequences&lt;/li&gt;&lt;li&gt;Learn the security best practices in C#&lt;/li&gt;&lt;li&gt;Correctly implementing various security features&lt;/li&gt;&lt;li&gt;Managing vulnerabilities in third party components&lt;/li&gt;&lt;li&gt;Understanding how cryptography supports security&lt;/li&gt;&lt;li&gt;Learning how to use cryptographic APIs correctly in C#&lt;/li&gt;&lt;li&gt;All this put into the context of GitHub Copilot&lt;/li&gt;&lt;/ul&gt;&lt;h4&gt;&lt;/h4&gt;
&lt;h4&gt;&lt;/h4&gt;</objective><essentials>&lt;p&gt;General C# development&lt;/p&gt;</essentials><audience>&lt;p&gt;C# developers using Copilot or other GenAI tools&lt;/p&gt;</audience><contents>&lt;h4&gt;Day 1&lt;/h4&gt;&lt;h4&gt;Coding responsibly with GenAI&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;What is responsible AI?&lt;/li&gt;&lt;li&gt;What is security?&lt;/li&gt;&lt;li&gt;Threat and risk&lt;/li&gt;&lt;li&gt;Cyber security threat types &amp;ndash; the CIA triad&lt;/li&gt;&lt;li&gt;Consequences of insecure software&lt;/li&gt;&lt;li&gt;Security and responsible AI in software development&lt;/li&gt;&lt;li&gt;GenAI tools in coding: Copilot, Codeium and others&lt;/li&gt;&lt;li&gt;Input validation
&lt;ul&gt;
&lt;li&gt;Input validation principles&lt;/li&gt;&lt;li&gt;Denylists and allowlists&lt;/li&gt;&lt;li&gt;What to validate &amp;ndash; the attack surface&lt;/li&gt;&lt;li&gt;Where to validate &amp;ndash; defense in depth&lt;/li&gt;&lt;li&gt;When to validate &amp;ndash; validation vs transformations&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Injection
&lt;ul&gt;
&lt;li&gt;Code injection&lt;/li&gt;&lt;li&gt;OS command injection&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Command injection&lt;/li&gt;&lt;li&gt;OS command injection best practices&lt;/li&gt;&lt;li&gt;Avoiding command injection with the right APIs&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Command injection best practices&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Experimenting with command injection in Copilot&lt;/li&gt;&lt;li&gt;Case study &amp;ndash; Command injection in Ruckus&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Integer handling problems
&lt;ul&gt;
&lt;li&gt;Representing signed numbers&lt;/li&gt;&lt;li&gt;Integer visualization&lt;/li&gt;&lt;li&gt;Integer overflow&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Integer overflow&lt;/li&gt;&lt;li&gt;Signed / unsigned confusion&lt;/li&gt;&lt;li&gt;Case study &amp;ndash; The Stockholm Stock Exchange&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Signed / unsigned confusion&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Experimenting with signed / unsigned confusion in Copilot&lt;/li&gt;&lt;li&gt;Integer truncation&lt;/li&gt;&lt;li&gt;Best practices&lt;/li&gt;&lt;li&gt;Upcasting&lt;/li&gt;&lt;li&gt;Precondition testing&lt;/li&gt;&lt;li&gt;Postcondition testing&lt;/li&gt;&lt;li&gt;Integer handling in C#&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Checked arithmetics&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Experimenting with integer overflow in Copilot&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Files and streams
&lt;ul&gt;
&lt;li&gt;Path traversal&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Path traversal&lt;/li&gt;&lt;li&gt;Additional challenges in Windows&lt;/li&gt;&lt;li&gt;Case study &amp;ndash; File spoofing in WinRAR&lt;/li&gt;&lt;li&gt;Path traversal best practices&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Path canonicalization&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Experimenting with path traversal in Copilot&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h4&gt;Day 2&lt;/h4&gt;&lt;h4&gt;Input validation&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;Unsafe reflection
&lt;ul&gt;
&lt;li&gt;Reflection without validation&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Unsafe reflection&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Experimenting with unsafe reflection in Copilot&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Unsafe native code
&lt;ul&gt;
&lt;li&gt;Native code dependence&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Unsafe native code&lt;/li&gt;&lt;li&gt;Best practices for dealing with native code&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Security features
&lt;ul&gt;
&lt;li&gt;Authentication
&lt;ul&gt;
&lt;li&gt;Authentication basics&lt;/li&gt;&lt;li&gt;Multi-factor authentication (MFA)&lt;/li&gt;&lt;li&gt;Case study &amp;ndash; The InfinityGauntlet attack&lt;/li&gt;&lt;li&gt;Time-based One Time Passwords (TOTP)&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Password management
&lt;ul&gt;
&lt;li&gt;Inbound password management&lt;/li&gt;&lt;li&gt;Storing account passwords&lt;/li&gt;&lt;li&gt;Password in transit&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Is just hashing passwords enough?&lt;/li&gt;&lt;li&gt;Dictionary attacks and brute forcing&lt;/li&gt;&lt;li&gt;Salting&lt;/li&gt;&lt;li&gt;Adaptive hash functions for password storage&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Using adaptive hash functions in C#&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Using adaptive hash functions in Copilot&lt;/li&gt;&lt;li&gt;Case study &amp;ndash; Veeam missing authentication and cleartext password storage&lt;/li&gt;&lt;li&gt;Password policy&lt;/li&gt;&lt;li&gt;NIST authenticator requirements for memorized secrets&lt;/li&gt;&lt;li&gt;Password database migration&lt;/li&gt;&lt;li&gt;Hard coded passwords&lt;/li&gt;&lt;li&gt;Best practices&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Hardcoded password&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Protecting sensitive information in memory
&lt;ul&gt;
&lt;li&gt;Challenges in protecting memory&lt;/li&gt;&lt;li&gt;Case study &amp;ndash; Microsoft secret key theft via dump files&lt;/li&gt;&lt;li&gt;Storing sensitive data in memory&lt;/li&gt;&lt;li&gt;Case study &amp;ndash; KeePass password leakage via strings&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Information exposure
&lt;ul&gt;
&lt;li&gt;Exposure through extracted data and aggregation&lt;/li&gt;&lt;li&gt;Case study &amp;ndash; Strava data exposure&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Platform security
&lt;ul&gt;
&lt;li&gt;.NET platform security&lt;/li&gt;&lt;li&gt;Protecting .NET code and applications&lt;/li&gt;&lt;li&gt;Code signing&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Denial of service
&lt;ul&gt;
&lt;li&gt;Flooding&lt;/li&gt;&lt;li&gt;Resource exhaustion&lt;/li&gt;&lt;li&gt;Algorithmic complexity issues&lt;/li&gt;&lt;li&gt;Regular expression denial of service (ReDoS)&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; ReDoS&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Experimenting with ReDoS in Copilot&lt;/li&gt;&lt;li&gt;Dealing with ReDoS&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Using vulnerable components
&lt;ul&gt;
&lt;li&gt;Case study &amp;ndash; The Polyfill.io supply chain attack&lt;/li&gt;&lt;li&gt;Vulnerability management&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Finding vulnerabilities in third-party components&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Security of AI generated code
&lt;ul&gt;
&lt;li&gt;Practical attacks against code generation tools&lt;/li&gt;&lt;li&gt;Dependency hallucination via generative AI&lt;/li&gt;&lt;li&gt;Case study &amp;ndash; A history of GitHub Copilot weaknesses (up to mid 2024)&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;

&lt;h4&gt;Day 3&lt;/h4&gt;

&lt;h4&gt;Cryptography for developers&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Cryptography basics&lt;/li&gt;&lt;li&gt;Crypto APIs in C#&lt;/li&gt;&lt;li&gt;Elementary algorithms&lt;/li&gt;&lt;li&gt;Hashing
&lt;ul&gt;
&lt;li&gt;Hashing basics&lt;/li&gt;&lt;li&gt;Hashing in C#&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Hashing in C# (exploring with Copilot)&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Random number generation
&lt;ul&gt;
&lt;li&gt;Pseudo random number generators (PRNGs)&lt;/li&gt;&lt;li&gt;Cryptographically secure PRNGs&lt;/li&gt;&lt;li&gt;Weak and strong PRNGs&lt;/li&gt;&lt;li&gt;Using random numbers in C#&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Using random numbers in C# (exploring with Copilot)&lt;/li&gt;&lt;li&gt;Case study &amp;ndash; Equifax credit account freeze&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Confidentiality protection
&lt;ul&gt;
&lt;li&gt;Symmetric encryption
&lt;ul&gt;
&lt;li&gt;Block ciphers&lt;/li&gt;&lt;li&gt;Modes of operation&lt;/li&gt;&lt;li&gt;Modes of operation and IV &amp;ndash; best practices&lt;/li&gt;&lt;li&gt;Symmetric encryption in C#&lt;/li&gt;&lt;li&gt;Symmetric encryption in C# with streams&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Symmetric encryption in C# (exploring with Copilot)&lt;/li&gt;&lt;li&gt;Case study &amp;ndash; Padding oracle used in RCE against Citrix ShareFile&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Asymmetric encryption
&lt;ul&gt;
&lt;li&gt;The RSA algorithm&lt;/li&gt;&lt;li&gt;RSA in C#&lt;/li&gt;&lt;li&gt;Combining symmetric and asymmetric algorithms&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Key exchange and agreement
&lt;ul&gt;
&lt;li&gt;Key exchange&lt;/li&gt;&lt;li&gt;Diffie-Hellman key agreement algorithm&lt;/li&gt;&lt;li&gt;Key exchange pitfalls and best practices&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Integrity protection
&lt;ul&gt;
&lt;li&gt;Message Authentication Code (MAC)&lt;/li&gt;&lt;li&gt;Calculating HMAC in C#&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Calculating MAC in C#&lt;/li&gt;&lt;li&gt;Digital signature
&lt;ul&gt;
&lt;li&gt;Digital signature with RSA&lt;/li&gt;&lt;li&gt;Elliptic Curve Cryptography&lt;/li&gt;&lt;li&gt;ECC basics&lt;/li&gt;&lt;li&gt;Digital signature with ECC&lt;/li&gt;&lt;li&gt;Digital signature in C#&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Digital signature with ECDSA in C#&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Common software security weaknesses
&lt;ul&gt;
&lt;li&gt;Code quality
&lt;ul&gt;
&lt;li&gt;Code quality and security&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Data handling
&lt;ul&gt;
&lt;li&gt;Initialization and cleanup&lt;/li&gt;&lt;li&gt;Class initialization cycles&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Initialization cycles (exploring with Copilot)&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Object oriented programming pitfalls
&lt;ul&gt;
&lt;li&gt;Inheritance and overriding&lt;/li&gt;&lt;li&gt;Mutability&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Mutable object (exploring with Copilot)&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Serialization
&lt;ul&gt;
&lt;li&gt;Serialization and deserialization challenges&lt;/li&gt;&lt;li&gt;Integrity &amp;ndash; deserializing untrusted streams&lt;/li&gt;&lt;li&gt;Integrity &amp;ndash; deserialization best practices&lt;/li&gt;&lt;li&gt;Look ahead deserialization&lt;/li&gt;&lt;li&gt;Property Oriented Programming (POP)&lt;/li&gt;&lt;li&gt;Creating a POP payload&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Creating a POP payload&lt;/li&gt;&lt;li&gt;Lab &amp;ndash; Using the POP payload&lt;/li&gt;&lt;li&gt;Case study &amp;ndash; Deserialization RCE in Veeam&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Wrap up
&lt;ul&gt;
&lt;li&gt;Secure coding principles&lt;/li&gt;&lt;li&gt;Principles of robust programming by Matt Bishop&lt;/li&gt;&lt;li&gt;Secure design principles of Saltzer and Schroeder&lt;/li&gt;&lt;li&gt;And now what?&lt;/li&gt;&lt;li&gt;Software security sources and further reading&lt;/li&gt;&lt;li&gt;.NET and C# resources&lt;/li&gt;&lt;li&gt;Responsible AI principles in software development&lt;/li&gt;&lt;li&gt;Generative AI &amp;ndash; Resources and additional guidance&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;</contents><objective_plain>- Understanding the essentials of responsible AI
- Getting familiar with essential cyber security concepts
- Input validation approaches and principles
- Identify vulnerabilities and their consequences
- Learn the security best practices in C#
- Correctly implementing various security features
- Managing vulnerabilities in third party components
- Understanding how cryptography supports security
- Learning how to use cryptographic APIs correctly in C#
- All this put into the context of GitHub Copilot</objective_plain><essentials_plain>General C# development</essentials_plain><audience_plain>C# developers using Copilot or other GenAI tools</audience_plain><contents_plain>Day 1

Coding responsibly with GenAI


- What is responsible AI?
- What is security?
- Threat and risk
- Cyber security threat types – the CIA triad
- Consequences of insecure software
- Security and responsible AI in software development
- GenAI tools in coding: Copilot, Codeium and others
- Input validation

- Input validation principles
- Denylists and allowlists
- What to validate – the attack surface
- Where to validate – defense in depth
- When to validate – validation vs transformations
- Injection

- Code injection
- OS command injection
- Lab – Command injection
- OS command injection best practices
- Avoiding command injection with the right APIs
- Lab – Command injection best practices
- Lab – Experimenting with command injection in Copilot
- Case study – Command injection in Ruckus
- Integer handling problems

- Representing signed numbers
- Integer visualization
- Integer overflow
- Lab – Integer overflow
- Signed / unsigned confusion
- Case study – The Stockholm Stock Exchange
- Lab – Signed / unsigned confusion
- Lab – Experimenting with signed / unsigned confusion in Copilot
- Integer truncation
- Best practices
- Upcasting
- Precondition testing
- Postcondition testing
- Integer handling in C#
- Lab – Checked arithmetics
- Lab – Experimenting with integer overflow in Copilot
- Files and streams

- Path traversal
- Lab – Path traversal
- Additional challenges in Windows
- Case study – File spoofing in WinRAR
- Path traversal best practices
- Lab – Path canonicalization
- Lab – Experimenting with path traversal in Copilot
Day 2

Input validation


- Unsafe reflection

- Reflection without validation
- Lab – Unsafe reflection
- Lab – Experimenting with unsafe reflection in Copilot
- Unsafe native code

- Native code dependence
- Lab – Unsafe native code
- Best practices for dealing with native code
- Security features

- Authentication

- Authentication basics
- Multi-factor authentication (MFA)
- Case study – The InfinityGauntlet attack
- Time-based One Time Passwords (TOTP)
- Password management

- Inbound password management
- Storing account passwords
- Password in transit
- Lab – Is just hashing passwords enough?
- Dictionary attacks and brute forcing
- Salting
- Adaptive hash functions for password storage
- Lab – Using adaptive hash functions in C#
- Lab – Using adaptive hash functions in Copilot
- Case study – Veeam missing authentication and cleartext password storage
- Password policy
- NIST authenticator requirements for memorized secrets
- Password database migration
- Hard coded passwords
- Best practices
- Lab – Hardcoded password
- Protecting sensitive information in memory

- Challenges in protecting memory
- Case study – Microsoft secret key theft via dump files
- Storing sensitive data in memory
- Case study – KeePass password leakage via strings
- Information exposure

- Exposure through extracted data and aggregation
- Case study – Strava data exposure
- Platform security

- .NET platform security
- Protecting .NET code and applications
- Code signing
- Denial of service

- Flooding
- Resource exhaustion
- Algorithmic complexity issues
- Regular expression denial of service (ReDoS)
- Lab – ReDoS
- Lab – Experimenting with ReDoS in Copilot
- Dealing with ReDoS
- Using vulnerable components

- Case study – The Polyfill.io supply chain attack
- Vulnerability management
- Lab – Finding vulnerabilities in third-party components
- Security of AI generated code

- Practical attacks against code generation tools
- Dependency hallucination via generative AI
- Case study – A history of GitHub Copilot weaknesses (up to mid 2024)


Day 3



Cryptography for developers




- Cryptography basics
- Crypto APIs in C#
- Elementary algorithms
- Hashing

- Hashing basics
- Hashing in C#
- Lab – Hashing in C# (exploring with Copilot)
- Random number generation

- Pseudo random number generators (PRNGs)
- Cryptographically secure PRNGs
- Weak and strong PRNGs
- Using random numbers in C#
- Lab – Using random numbers in C# (exploring with Copilot)
- Case study – Equifax credit account freeze
- Confidentiality protection

- Symmetric encryption

- Block ciphers
- Modes of operation
- Modes of operation and IV – best practices
- Symmetric encryption in C#
- Symmetric encryption in C# with streams
- Lab – Symmetric encryption in C# (exploring with Copilot)
- Case study – Padding oracle used in RCE against Citrix ShareFile
- Asymmetric encryption

- The RSA algorithm
- RSA in C#
- Combining symmetric and asymmetric algorithms
- Key exchange and agreement

- Key exchange
- Diffie-Hellman key agreement algorithm
- Key exchange pitfalls and best practices
- Integrity protection

- Message Authentication Code (MAC)
- Calculating HMAC in C#
- Lab – Calculating MAC in C#
- Digital signature

- Digital signature with RSA
- Elliptic Curve Cryptography
- ECC basics
- Digital signature with ECC
- Digital signature in C#
- Lab – Digital signature with ECDSA in C#
- Common software security weaknesses

- Code quality

- Code quality and security
- Data handling

- Initialization and cleanup
- Class initialization cycles
- Lab – Initialization cycles (exploring with Copilot)
- Object oriented programming pitfalls

- Inheritance and overriding
- Mutability
- Lab – Mutable object (exploring with Copilot)
- Serialization

- Serialization and deserialization challenges
- Integrity – deserializing untrusted streams
- Integrity – deserialization best practices
- Look ahead deserialization
- Property Oriented Programming (POP)
- Creating a POP payload
- Lab – Creating a POP payload
- Lab – Using the POP payload
- Case study – Deserialization RCE in Veeam
- Wrap up

- Secure coding principles
- Principles of robust programming by Matt Bishop
- Secure design principles of Saltzer and Schroeder
- And now what?
- Software security sources and further reading
- .NET and C# resources
- Responsible AI principles in software development
- Generative AI – Resources and additional guidance</contents_plain><duration unit="d" days="3">3 days</duration><pricelist><price country="DE" currency="EUR">2250.00</price><price country="SI" currency="EUR">2250.00</price><price country="AT" currency="EUR">2250.00</price><price country="SE" currency="EUR">2250.00</price><price country="CH" currency="CHF">2250.00</price></pricelist><miles/></course>