<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://www.smithnet.org.uk/wiki/index.php?action=history&amp;feed=atom&amp;title=Secure_Code_Design_and_Implementation</id>
	<title>Secure Code Design and Implementation - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.smithnet.org.uk/wiki/index.php?action=history&amp;feed=atom&amp;title=Secure_Code_Design_and_Implementation"/>
	<link rel="alternate" type="text/html" href="https://www.smithnet.org.uk/wiki/index.php?title=Secure_Code_Design_and_Implementation&amp;action=history"/>
	<updated>2026-04-27T15:20:12Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://www.smithnet.org.uk/wiki/index.php?title=Secure_Code_Design_and_Implementation&amp;diff=608&amp;oldid=prev</id>
		<title>NickPGSmith: 2 revisions imported</title>
		<link rel="alternate" type="text/html" href="https://www.smithnet.org.uk/wiki/index.php?title=Secure_Code_Design_and_Implementation&amp;diff=608&amp;oldid=prev"/>
		<updated>2024-05-08T04:53:42Z</updated>

		<summary type="html">&lt;p&gt;2 revisions imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 04:53, 8 May 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en-GB&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>NickPGSmith</name></author>
	</entry>
	<entry>
		<id>https://www.smithnet.org.uk/wiki/index.php?title=Secure_Code_Design_and_Implementation&amp;diff=607&amp;oldid=prev</id>
		<title>NickPGSmith: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://www.smithnet.org.uk/wiki/index.php?title=Secure_Code_Design_and_Implementation&amp;diff=607&amp;oldid=prev"/>
		<updated>2023-02-17T21:02:13Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:02, 17 February 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en-GB&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>NickPGSmith</name></author>
	</entry>
	<entry>
		<id>https://www.smithnet.org.uk/wiki/index.php?title=Secure_Code_Design_and_Implementation&amp;diff=606&amp;oldid=prev</id>
		<title>NickPGSmith: /* Application Attacks */</title>
		<link rel="alternate" type="text/html" href="https://www.smithnet.org.uk/wiki/index.php?title=Secure_Code_Design_and_Implementation&amp;diff=606&amp;oldid=prev"/>
		<updated>2022-01-07T18:49:55Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Application Attacks&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Software Development Lifecycle ==&lt;br /&gt;
&lt;br /&gt;
=== Software Platforms ===&lt;br /&gt;
&lt;br /&gt;
* Endpoint applications (self contained on device)&lt;br /&gt;
* Client/Server apps&lt;br /&gt;
&lt;br /&gt;
=== Development Methodologies ===&lt;br /&gt;
&lt;br /&gt;
Incorporate security at every stage&lt;br /&gt;
* Waterfall: rigid, linear, steps&lt;br /&gt;
* Spiral: iterative process&lt;br /&gt;
** Begin / Dev &amp;amp; Test / Risk Assess / Determine Requirements / recycle&lt;br /&gt;
* Agile (continuous dev, short dev/release cycles); prioritise:&lt;br /&gt;
** Individuals/interactions over processes/tools&lt;br /&gt;
** Working Software over documentation&lt;br /&gt;
** Customer collaboration over contracts&lt;br /&gt;
** Respond to change over follow plan&lt;br /&gt;
&lt;br /&gt;
=== Maturity Models ===&lt;br /&gt;
&lt;br /&gt;
Standard benchmarks:&lt;br /&gt;
CMMI (Capability Maturity Model Integration):&lt;br /&gt;
* Initial&lt;br /&gt;
* Managed&lt;br /&gt;
** Reuse code, config management, project planning, QA, requirements management&lt;br /&gt;
* Defined&lt;br /&gt;
** Documented practices, integrated project management, risk management, validation, etc&lt;br /&gt;
* Quantitatively Managed&lt;br /&gt;
** Organisation process management, quantitative project management&lt;br /&gt;
* Optimising&lt;br /&gt;
** Continuous process management, causal management and resolution&lt;br /&gt;
Current version used for software dev plus supply chain and others.&lt;br /&gt;
&lt;br /&gt;
IDEAL model is an alternative:&lt;br /&gt;
* Initialising&lt;br /&gt;
* Diagnosing&lt;br /&gt;
* Establishing&lt;br /&gt;
* Action&lt;br /&gt;
* Learning&lt;br /&gt;
&lt;br /&gt;
=== Change Management ===&lt;br /&gt;
&lt;br /&gt;
* Request control&lt;br /&gt;
* Change control &amp;gt; through CAB, docs&lt;br /&gt;
* Release management &amp;gt; through QA against RFC&lt;br /&gt;
* Dev &amp;gt; Test &amp;gt; Staging &amp;gt; Production environments&lt;br /&gt;
&lt;br /&gt;
=== Automation and DevOps ===&lt;br /&gt;
&lt;br /&gt;
Build collaborative relationships&lt;br /&gt;
Embrace automation&lt;br /&gt;
Facilitate rapid releases&lt;br /&gt;
Provide a stable operating environments&lt;br /&gt;
&lt;br /&gt;
DevOps and Agile both seek continuous operation &amp;quot;interactions as code2 &amp;gt; eg script to change&lt;br /&gt;
Base OS image to specific requirement &amp;gt; scalable, use of immutable servers, reduce errors, facilitate testing&lt;br /&gt;
Facilitates security automation &amp;gt; &amp;quot;DevSecOps&amp;quot;&lt;br /&gt;
* Continuous validation&lt;br /&gt;
* Continuous integration&lt;br /&gt;
* Continuous delivery&lt;br /&gt;
* Continuous deployment&lt;br /&gt;
* Continuous monitoring&lt;br /&gt;
&lt;br /&gt;
== Software Quality Assurance ==&lt;br /&gt;
&lt;br /&gt;
=== Code Review ===&lt;br /&gt;
&lt;br /&gt;
Peer analysis&lt;br /&gt;
Formal, FAGAN:&lt;br /&gt;
* Planning&lt;br /&gt;
* Overview &amp;gt; assign roles&lt;br /&gt;
* Preparation&lt;br /&gt;
* Meeting &amp;gt; discuss issues/defects&lt;br /&gt;
* Rework &amp;gt; corrective actions&lt;br /&gt;
* Follow-up &amp;gt; confirm finish&lt;br /&gt;
(repeat)&lt;br /&gt;
&lt;br /&gt;
=== Software Testing ===&lt;br /&gt;
&lt;br /&gt;
* Verification and validation: are we building the right software &amp;amp; are we building the software right&lt;br /&gt;
* Stress testing&lt;br /&gt;
* UAT&lt;br /&gt;
* Regression testing&lt;br /&gt;
&lt;br /&gt;
=== Code Security Tests ===&lt;br /&gt;
&lt;br /&gt;
Static: software is examined for common errors&lt;br /&gt;
Dynamic: code is executed and tested (synthetic transactions)&lt;br /&gt;
&lt;br /&gt;
=== Fuzz Testing ===&lt;br /&gt;
&lt;br /&gt;
Dev supplied input, valid or invalid&lt;br /&gt;
* Generation&lt;br /&gt;
* Mutation (real date + changes)&lt;br /&gt;
* eg use Zed Attack Proxy (ZAP)&lt;br /&gt;
&lt;br /&gt;
=== Code Repositories ===&lt;br /&gt;
&lt;br /&gt;
Avoid dead code&lt;br /&gt;
Public or private&lt;br /&gt;
Sensitive info must be removed from public repositories&lt;br /&gt;
Integrity management &amp;gt; check hashes&lt;br /&gt;
&lt;br /&gt;
=== Application Management ===&lt;br /&gt;
&lt;br /&gt;
Control: whilelist/blacklist&lt;br /&gt;
&lt;br /&gt;
eg Windows AppLocker (restrict running of software)&lt;br /&gt;
&lt;br /&gt;
Automated processes for updates&lt;br /&gt;
&lt;br /&gt;
Host system baselining&lt;br /&gt;
&lt;br /&gt;
=== Third-party Code ===&lt;br /&gt;
&lt;br /&gt;
Libraries, SDKs, APIs, Outsourced code&lt;br /&gt;
&lt;br /&gt;
== Application Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== OWASP Top 10 ===&lt;br /&gt;
&lt;br /&gt;
* Injection flaws&lt;br /&gt;
* Broken authentication&lt;br /&gt;
* Sensitive data exposure&lt;br /&gt;
* External entities&lt;br /&gt;
* Broken access control&lt;br /&gt;
* Security misconfiguration&lt;br /&gt;
* XSS&lt;br /&gt;
* Insecure deserialization&lt;br /&gt;
* Using components with known vulnerability&lt;br /&gt;
* Insufficient logging/monitoring&lt;br /&gt;
&lt;br /&gt;
=== Application Security ===&lt;br /&gt;
&lt;br /&gt;
Application hardening:&lt;br /&gt;
* Use proper auth, encrypt data, validate user input, avoid/remediate known exploits, deploy obfuscaton and camouflage&lt;br /&gt;
* Prompt patching is critical&lt;br /&gt;
* Application config:&lt;br /&gt;
** type and scope of encryption&lt;br /&gt;
** access granted to authorise&lt;br /&gt;
** security of underlying infrastructure&lt;br /&gt;
&lt;br /&gt;
Configuration baselines allow quick identification&lt;br /&gt;
&lt;br /&gt;
=== Prevent SQL Injection ===&lt;br /&gt;
&lt;br /&gt;
Input validation eg never pass single quotes; use parameterised SQL&lt;br /&gt;
&lt;br /&gt;
=== Cross-site Scripting ===&lt;br /&gt;
&lt;br /&gt;
Takes place without knowledge of victim. Don&amp;#039;t allow &amp;lt;script&amp;gt; in user input.&lt;br /&gt;
&lt;br /&gt;
=== Request Forgery (CSRF/XSRF) ===&lt;br /&gt;
&lt;br /&gt;
Uses the fact often many tabs open to different sites; auth cookies transfer between tabs. eg &amp;lt;img&amp;gt; tag but URL executes another function&lt;br /&gt;
* Rearchitect web app -&amp;gt; don&amp;#039;t use GETs; auto-logging out users after time.&lt;br /&gt;
&lt;br /&gt;
=== Server Side Request Forgery (SSRF) ===&lt;br /&gt;
&lt;br /&gt;
Change metadata; being send to sever to trick&lt;br /&gt;
&lt;br /&gt;
=== Defend Against Directory Traversal ===&lt;br /&gt;
&lt;br /&gt;
* Webgoat and ZAP&lt;br /&gt;
* Prevent &amp;quot;.&amp;quot; in input&lt;br /&gt;
* Strict access control&lt;br /&gt;
&lt;br /&gt;
=== Overflow Attacks ===&lt;br /&gt;
&lt;br /&gt;
When buffer size is insufficient for input data&lt;br /&gt;
&lt;br /&gt;
=== Cookies and Attachments ===&lt;br /&gt;
&lt;br /&gt;
Stored in browser; track activity. Used in apps too.&lt;br /&gt;
&lt;br /&gt;
=== Session Hijacking ===&lt;br /&gt;
&lt;br /&gt;
Cookie provides an authentication session reference. If not random -&amp;gt; guessable&lt;br /&gt;
* Cookie guessing&lt;br /&gt;
* Session replay attacks&lt;br /&gt;
* Should be sent over an encrypted channel&lt;br /&gt;
&lt;br /&gt;
=== Code Execution Attacks ===&lt;br /&gt;
&lt;br /&gt;
* Arbitrary code execution (perhaps remote)&lt;br /&gt;
* Install malicious code&lt;br /&gt;
* Join a botnet&lt;br /&gt;
* Create accounts for later use&lt;br /&gt;
&lt;br /&gt;
Mitigate by:&lt;br /&gt;
* Limit application access&lt;br /&gt;
* Patch systems &amp;amp; applications&lt;br /&gt;
&lt;br /&gt;
=== Privilege Escalation ===&lt;br /&gt;
&lt;br /&gt;
Gain administrative access attacks&lt;br /&gt;
* Perform input validation&lt;br /&gt;
* Enforce least privilege principle&lt;br /&gt;
* Use DEP and ALSR technologies&lt;br /&gt;
&lt;br /&gt;
=== Driver Manipulation ===&lt;br /&gt;
&lt;br /&gt;
=== Memory Vulnerabilities ===&lt;br /&gt;
&lt;br /&gt;
=== Race Condition Vulnerabilities ===&lt;br /&gt;
&lt;br /&gt;
== Secure Coding Practices ==&lt;br /&gt;
&lt;br /&gt;
=== Input Validation ===&lt;br /&gt;
&lt;br /&gt;
* Whitelisting: powerful but not always possible&lt;br /&gt;
* Blacklisting: eg prohibit SQL keywords&lt;br /&gt;
&lt;br /&gt;
=== Parameterized Queries ===&lt;br /&gt;
&lt;br /&gt;
* SQL is not sent, only data to a stored procedure&lt;br /&gt;
&lt;br /&gt;
=== Authentication and Session Management Issues ===&lt;br /&gt;
&lt;br /&gt;
* Never store plaintext passwords: use hashed &amp;amp; slated (protect against rainbow attacks)&lt;br /&gt;
* Encrypt passwords in transit: TLS&lt;br /&gt;
&lt;br /&gt;
=== Output Encoding ===&lt;br /&gt;
&lt;br /&gt;
Take a dangerous character and replace, eg HTML encoding; URL encoding&lt;br /&gt;
&lt;br /&gt;
=== Error and Exception Handling ===&lt;br /&gt;
&lt;br /&gt;
=== Code Signing ===&lt;br /&gt;
&lt;br /&gt;
* Obtain a cert from a CA; sign code&lt;br /&gt;
* Check public key to validate the signature&amp;#039;s hash matches this code&lt;br /&gt;
&lt;br /&gt;
=== Database Security ===&lt;br /&gt;
&lt;br /&gt;
* Database normalisation&lt;br /&gt;
** prevent inconsistency&lt;br /&gt;
** prevent update anomalies&lt;br /&gt;
** reduce need for restructuring&lt;br /&gt;
** make DB schema more informative&lt;br /&gt;
&lt;br /&gt;
1st Normal Form&lt;br /&gt;
* Create separate tables for different sets of related data&lt;br /&gt;
* Provide a primary key for every table&lt;br /&gt;
* Records may not have multivalued fields&lt;br /&gt;
* Records in a table must have the same number of fields&lt;br /&gt;
&lt;br /&gt;
2nd Normal Form (adds)&lt;br /&gt;
* Every non-key fields must be a fact about the entire key&lt;br /&gt;
&lt;br /&gt;
3rd Normal Form (adds)&lt;br /&gt;
* No non-key fields may be a fact about another non-key fields&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
* Information at rest in a DB&lt;br /&gt;
* Database activity monitoring&lt;br /&gt;
* Use stored procedures where possible&lt;br /&gt;
&lt;br /&gt;
=== Data Deidentification ===&lt;br /&gt;
&lt;br /&gt;
Identifying individuals, eg ZIP/Birthday/Gender combination -&amp;gt; 87% unique&lt;br /&gt;
&lt;br /&gt;
Anonymise data -&amp;gt; HIPPA standard&lt;br /&gt;
* Expert determination approach&lt;br /&gt;
* Safe harbour approach -&amp;gt; remove standard IDs&lt;br /&gt;
&lt;br /&gt;
=== Data deobfuscation ===&lt;br /&gt;
&lt;br /&gt;
* Hashing &amp;amp; salting&lt;br /&gt;
* Tokenisation: replaces sensitive fields with random identifiers&lt;br /&gt;
* Hashing: redact sensitive information&lt;/div&gt;</summary>
		<author><name>NickPGSmith</name></author>
	</entry>
</feed>