Saturday, May 4, 2024

M7 infracstructure as code (IAC)

This is the second to the last module in the ALAMOSE workshop

 

M7-SECURITY WEAKNESS IN INFRASTRUCTURE AS CODE (IAC) SCRIPTS

Infrastructure as code (IAC)

automated resource management

Common security weakness in IAC
  misconfigurations such as hard coded password
  hardcoded secrets such as API keys
 guessable user: admin, root, ubutnu
 parts are open (micro services API and search engine etc)
 resources (database) accessible from outside etc
 did not hide server and tech stack information


Glitch is a framework which detects IAC smells automatically
detects different security smells written in Ansible, Puppert of Chef

M7-SECURITY WEAKNESS IN INFRASTRUCTURE AS CODE (IAC) SCRIPTS

Description

Identifying security weaknesses, such as hard-coded passwords, hard coded secrets, weak crypto, full permission in of files etc in chef, puppet, ansible, terraform, SaltStack scripts, which are used to automatically set up and manage the infrastructure of technology systems is called infrastructure as code (IaC).

Courses Where This Module Is Integrated

Activities 

Pre-lab Content Dissemination

A security weakness is an error, a flaw such as an insecure coding pattern that can lead to vulnerability. A security weakness, such as a hard-coded secret, can be propagated to other parts of the program. A flow analysis is a process to identify how security weaknesses, such as insecure coding patterns in a program, can propagate security weaknesses within a software system.


In-class Hands-on Experience(using Mac)

brew install poetry

poetry install

---

- name: create an app with full permission

  file:

    path: /app

    owner: foo

    group: foo

    mode: "0777"

poetry run glitch --tech ansible --csv test.yaml

Post Lab Experience

The use of specific keywords such as hack, fixme, todo, bug, later, and bug in comments can reveal missing security functionality and the presence of bugs (CWE-546). In the following figure, we demonstrated steps for automatically identifying suspicious comments in Ansible scripts.

 
 

M4 - AUTOMATED FORENSICABILITY FOR SOFTWARE

 this is the second module in the ALAMOSE WORKSHOP

https://sites.google.com/view/alamose-v1/m4-forensics?authuser=0

M4 - AUTOMATED FORENSICABILITY FOR SOFTWARE

Description

Integrate forensics into software source code. 

Courses Where This Module Is Integrated

Activities 

Pre-lab Content Dissemination 

We first need to know what to log and how to log. Let us use the following heuristics. 

In-class Hands-on Experience


Post Lab Experience

Imagine this scenario: Dolly, a data science specialist at Auburn University. University has written machine learning (ML) code in `workshop9.py`. The output is correct, but she just learned about adversarial machine learning, which discusses how ML code can be attacked. She realized that ML models are susceptible to security issues:  

Assist Dolly by writing logging code in the correct locations in `workshop8.py` with comments so that the two issues, as mentioned earlier, are logged for all provided ML functions. After writing the code, put in comments to justify your code, save `workshop9.py`. 

Sample Input/Output:

Input: workshop8.py

Expected Output: Code and Comments

iris = datasets.load_iris()

'''

Inserted logging statement because data can be poisoned.

'''

simpleLogger.info('Generic information: getting results: %s', str(res))



Module 5 Git hooks

This is the first module in the Auburn ALAMOSE workshop

M5 - GIT HOOKS TO FACILITATE AUTOMATED SECURITY STATIC ANALYSIS
https://sites.google.com/view/alamose-v1/m5-hooks?authuser=0

=>What is Git

=>Why Git

=>Basic Git commands: git init, clone, add, commit, push, pull, status

=>What is Git Hooks? 
 customizable scripts triggers by Git events

=>Security benefit of Git Hooks
 code quality checks, enforce coding standards, run linters and static cocde analyers to indentify potential vulnerabilities. 
 Access control. 

=>Scope and types of Git Hooks
local, remote sides 

=> Use cases: pre-commit hook, commit-msg hook, post-commit hook, pre-receive hook, post-receive hook. 








M5 - GIT HOOKS TO FACILITATE AUTOMATED SECURITY STATIC ANALYSIS

Description

Use an existing tool and Git Hooks to activate a static analysis tool for a popular repository.

Courses Where This Module Is Integrated

Software Quality Assurance (Auburn University, Spring 2023, Fall 2023)
Mobile Security (Tuskegee University, Fall 2023)

Activities 

Pre-lab Content Dissemination

One negative perception of software quality assurance (SQA) is that it prohibits rapid deployment of software. That is why practitioners advocate SQA activities to be integrated into the software development and deployment process. To that end, in modern software engineering, practitioners prefer automated pipelines for security analysis. Instead of asking practitioners to look for security problems themselves, tools should do that for them. 

In that spirit, we as a class will build a mini tool that automatically runs static security analysis for NumCPP, (https://github.com/dpilger26/NumCpp), a popular library developed in C++ that contains a lot of data structure-related implementations. For this workshop, you will use "cppcheck" (https://cppcheck.sourceforge.io/) and `git hooks`. You will build a Git Hook that will help in identifying known security weaknesses automatically for practitioners who develop and use `NumCPP`.  


In-class Hands-on Experience 

Create a GitHub account if you haven't yet 
Install CPPCheck on your computer 
Fork the `NumCPP` repository with your GitHub account
Clone the forked repository on your computer  
Go to `.git/hooks/` in the cloned repository 
Run cp pre-commit.sample pre-commit.
Open `pre-commit
Edit `pre-commit` to run `cppcheck -h`
Modify any `.c` or `.cpp` file 
Commit the modified file to see the effects of the modified `pre-commit` hook   

A recording of the hands-on experience is available here


Post Lab Experience

Modify your `pre-commit` file so that it can scan your `NumCPP` repository whenever you commit any file.
Grab your output by capturing the screenshots.
Modify any CPP file in the `NumCPP` repository.







ALAMOSE dev op security

 

ALAMOSE dev op security

https://sites.google.com/view/alamose-v1/home?authuser=0


https://github.com/paser-group/ALAMOSE-PASER/tree/ALAMOSE



Wednesday, May 1, 2024

terra quantum info

 


Reuben Brasher

https://github.com/rbattq

https://github.com/terra-quantum-public/benchmarking/tree/main/QPU%20notebooks