<commit_before><!doctype html>
<html lang="en">

	<head>
		<meta charset="utf-8">

		<title>Injection Workshop</title>

		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />

		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">

		<link rel="stylesheet" href="css/reveal.css">
		<link rel="stylesheet" href="css/theme/black.css" id="theme">

		<!-- Code syntax highlighting -->
		<link rel="stylesheet" href="lib/css/zenburn.css">

                <style type="text/css">
                  pre.bigcode { text-align: center; font-size: 1em }
                  pre.medcode { text-align: center; font-size: 0.7em }
                  #speaker-controls { font-size: 0.3em }
                  .present ul li { margin-bottom: 0.5em }
                </style>

		<!-- Printing and PDF exports -->
		<script>
			var link = document.createElement( 'link' );
			link.rel = 'stylesheet';
			link.type = 'text/css';
			link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
			document.getElementsByTagName( 'head' )[0].appendChild( link );
		</script>

		<!--[if lt IE 9]>
		<script src="lib/js/html5shiv.js"></script>
		<![endif]-->
	</head>

	<body>

		<div class="reveal">

			<!-- Any section element inside of this container is displayed as a slide -->
			<div class="slides">

                          <section>
                            <h1>Injection</h1>
                            <h3>OWASP #1</h3>
                            <aside class="notes">
                              <ul>
                                <li>If you are doing hands on exercises, pair up participants</li>
                                <li>Ask who has experience with Java and SQL</li>
                                <li>Try to pair inexperienced with experienced</li>
                              </ul>
                            </aside>
                          </section>

                          <section>
                            <h2>Injection?</h2>
                            <ul>
                              <li>What are injection vulnerabilities?</li>
                              <li>What’s the worst that can happen?</li>
                            </ul>
                          </section>

                          <section>
                            <h2>Injection</h2>
                            <ul>
                              <li>"Injection flaws occur when an application sends untrusted data to an interpreter."</li>
                              <li>SQL, LDAP, Xpath, or NoSQL queries, OS commands, XML parsers, SMTP Headers, program arguments</li>
                            </ul>
                          </section>

                          <section>
                            <h2>Shellshock</h2>
                            <aside class="notes">
                              Shellshock is a code injection vulnerability
                            </aside>
                          </section>

                          <section>
                            <img width="100%" src="jonny-tables.png">
                            <pre style="text-align: center; font-size: 1em"><code>Robert'); DROP TABLE Students;--</code></pre>
                          </section>

                          <section>
                            <pre class="bigcode"><code>$name = "Robert'); DROP TABLE Students;--"</code></pre>
                            <pre class="bigcode"><code>SELECT * FROM Students WHERE name = '$name'</code></pre>
                            <p>=></p>
                            <pre class="medcode"><code>SELECT * FROM Students WHERE name = 'Robert'); DROP TABLE Students;--'</code></pre>
                          </section>

                          <section>
                            <h2>Vulnerable App</h2>
                            <pre class="bigcode"><code>telnet $IP 8888</code></pre>
                            <br/>
<pre class="bigcode" style="text-align: left"><code>// tip 1: sql used by app
select * from users where first_name = 'name'</code></pre>
                            <br/>
<pre class="bigcode" style="text-align: left"><code>// tip 2: derby is wierd
select * from x -- // crash
select * from x -- anytext // valid
</code></pre>
                            <aside class="notes">
                              <em>optional</em>
                              <ul>
                                <li>start application on your machine with ncat:</li>
                                <li>ncat -lktc 'java -jar target/injection-1.0-SNAPSHOT-jar-with-dependencies.jar' $IP 8888</li>
                              </ul>
                            </aside>
                          </section>

                          <section>
                            <h2>demo</h2>
                            <aside class="notes">
                              <ul>
                                <li>java -jar target/injection-1.0-SNAPSHOT-jar-with-dependencies.jar</li>
                                <li>' or 1=1 --comment</li>
                                <li>for i in $(seq 0 10); do echo "' or 1=1 offset $i rows --comment" | java -jar target/injection-1.0-SNAPSHOT-jar-with-dependencies.jar; done</li>
                              </ul>
                            </aside>
                          </section>

                          <section>
                            <h2>So what do we have to lose?</h2>
                            <ul>
                              <li>Confidentiality</li>
                              <li>Integrity</li>
                              <li>Availability</li>
                            </ul>
                            <aside class="notes">
                              Core app sec terminology
                            </aside>
                          </section>

                          <section>
                            <h2>Secure Code Checklist</h2>
                            <ul>
                              <li>delegate sql substitution to the database</li>
                              <li>encoding untrusted data</li>
                              <li>validation (in as many layers as possible)</li>
                              <li>whitelisting when possible</li>
                              <li>fail gracefully</li>
                            </ul>
                            <aside class="notes">
                              <p>untrusted data: "the most fundamental core idea of secure coding"</p>
                            </aside>
                          </section>

                          <section>
                            <h2>Fix it!</h2>
<pre><code>
  git clone <EMAIL>:jacksingleton/injection-workshop.git

  cd injection

  mvn test

</code></pre><commit_msg>add checks<commit_after><!doctype html>
<html lang="en">

	<head>
		<meta charset="utf-8">

		<title>Injection Workshop</title>

		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />

		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">

		<link rel="stylesheet" href="css/reveal.css">
		<link rel="stylesheet" href="css/theme/black.css" id="theme">

		<!-- Code syntax highlighting -->
		<link rel="stylesheet" href="lib/css/zenburn.css">

                <style type="text/css">
                  pre.bigcode { text-align: center; font-size: 1em }
                  pre.medcode { text-align: center; font-size: 0.7em }
                  #speaker-controls { font-size: 0.3em }
                  .present ul li { margin-bottom: 0.5em }
                </style>

		<!-- Printing and PDF exports -->
		<script>
			var link = document.createElement( 'link' );
			link.rel = 'stylesheet';
			link.type = 'text/css';
			link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
			document.getElementsByTagName( 'head' )[0].appendChild( link );
		</script>

		<!--[if lt IE 9]>
		<script src="lib/js/html5shiv.js"></script>
		<![endif]-->
	</head>

	<body>

		<div class="reveal">

			<!-- Any section element inside of this container is displayed as a slide -->
			<div class="slides">

                          <section>
                            <h1>Injection</h1>
                            <h3>OWASP #1</h3>
                            <aside class="notes">
                              <ul>
                                <li>If you are doing hands on exercises, pair up participants</li>
                                <li>Ask who has experience with Java and SQL</li>
                                <li>Try to pair inexperienced with experienced</li>
                              </ul>
                            </aside>
                          </section>

                          <section>
                            <h2>Injection?</h2>
                            <ul>
                              <li>What are injection vulnerabilities?</li>
                              <li>What’s the worst that can happen?</li>
                            </ul>
                          </section>

                          <section>
                            <h2>Injection</h2>
                            <ul>
                              <li>"Injection flaws occur when an application sends untrusted data to an interpreter."</li>
                              <li>SQL, LDAP, Xpath, or NoSQL queries, OS commands, XML parsers, SMTP Headers, program arguments</li>
                            </ul>
                          </section>

                          <section>
                            <h2>Shellshock</h2>
                            <aside class="notes">
                              Shellshock is a code injection vulnerability
                            </aside>
                          </section>

                          <section>
                            <img width="100%" src="jonny-tables.png">
                            <pre style="text-align: center; font-size: 1em"><code>Robert'); DROP TABLE Students;--</code></pre>
                          </section>

                          <section>
                            <pre class="bigcode"><code>$name = "Robert'); DROP TABLE Students;--"</code></pre>
                            <pre class="bigcode"><code>SELECT * FROM Students WHERE name = '$name'</code></pre>
                            <p>=></p>
                            <pre class="medcode"><code>SELECT * FROM Students WHERE name = 'Robert'); DROP TABLE Students;--'</code></pre>
                          </section>

                          <section>
                            <h2>Vulnerable App</h2>
                            <pre class="bigcode"><code>telnet $IP 8888</code></pre>
                            <br/>
<pre class="bigcode" style="text-align: left"><code>// tip 1: sql used by app
select * from users where first_name = 'name'</code></pre>
                            <br/>
<pre class="bigcode" style="text-align: left"><code>// tip 2: derby is wierd
select * from x -- // crash
select * from x -- anytext // valid
</code></pre>
                            <aside class="notes">
                              <em>optional</em>
                              <ul>
                                <li>start application on your machine with ncat:</li>
                                <li>ncat -lktc 'java -jar target/injection-1.0-SNAPSHOT-jar-with-dependencies.jar' $IP 8888</li>
                              </ul>
                            </aside>
                          </section>

                          <section>
                            <h2>demo</h2>
                            <aside class="notes">
                              <ul>
                                <li>java -jar target/injection-1.0-SNAPSHOT-jar-with-dependencies.jar</li>
                                <li>' or 1=1 --comment</li>
                                <li>for i in $(seq 0 10); do echo "' or 1=1 offset $i rows --comment" | java -jar target/injection-1.0-SNAPSHOT-jar-with-dependencies.jar; done</li>
                              </ul>
                            </aside>
                          </section>

                          <section>
                            <h2>So what do we have to lose?</h2>
                            <ul>
                              <li>Confidentiality ✓</li>
                              <li>Integrity ✓</li>
                              <li>Availability ✓</li>
                            </ul>
                            <aside class="notes">
                              Core app sec terminology
                            </aside>
                          </section>

                          <section>
                            <h2>Secure Code Checklist</h2>
                            <ul>
                              <li>delegate sql substitution to the database</li>
                              <li>encoding untrusted data</li>
                              <li>validation (in as many layers as possible)</li>
                              <li>whitelisting when possible</li>
                              <li>fail gracefully</li>
                            </ul>
                            <aside class="notes">
                              <p>untrusted data: "the most fundamental core idea of secure coding"</p>
                            </aside>
                          </section>

                          <section>
                            <h2>Fix it!</h2>
<pre><code>
  git clone <EMAIL>:jacksingleton/injection-workshop.git

  cd injection

  mvn test

</code></pre>
{'fraction_non_alphanumeric': 0.12021897284448606, 'fraction_numerical': 0.00907584815961968, 'mean_word_length': 1.0330941572704642, 'pattern_counts': {'":': 0, '<': 355, '<?xml version=': 0, '>': 357, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3184061', 'n_tokens_mistral': 3741, 'n_tokens_neox': 3453, 'n_words': 817}