SlideShare a Scribd company logo
1 of 5
CHAPTER 4
 Exercises for Part 1

Slides adapted from "Foundations of Security: What Every Programmer
Needs To Know" by Neil Daswani, Christoph Kern, and Anita Kesavan
(ISBN 1590597842; http://www.foundationsofsecurity.com). Except as
otherwise noted, the content of this presentation is licensed under the
Creative Commons 3.0 License.
Conceptual Exercises
   Are there dependencies between any of the
    security concepts that we covered? For
    example, is authentication required for
    authorization? Why or why not?

   What happens if a client connects to
    SimpleWebServer, but never sends any data
    and never disconnects? What type of an attack
    would such a client be able to conduct?
Programming Problem (1)
   HTTP supports a mechanism that allows users
    to upload files in addition to retrieving them
    through a PUT command.
     What   threats would you need to consider if
      SimpleWebServer also had functionality that could
      be used to upload files?
     For each of the specific threats you just listed, what
      types of security mechanisms might you put in place
      to mitigate the threats?
Programming Problem (2)
public void storeFile (BufferedReader br, OutputStreamWriter osw,
                       String pathname) throws Exception {
  FileWriter fw = null;
  try {
    fw = new FileWriter(pathname);
                                               Modify the
    String s = br.readLine();
    while (s != null) {
                                                processRequest()
      fw.write(s);
      s = br.readLine();
                                                method in SWS to
    }
    fw.close();
                                                use this file storage
    osw.write("HTTP/1.0 201 Created");
  } catch(Exception e) {
                                                and logging code.
    osw.write("HTTP/1.0 500 Internal Server Error");
  }
}
public void logEntry(String filename,String record) {
  FileWriter fw = new FileWriter (filename, true);
  fw.write(getTimestamp()+ " " + record);
  fw.close();
}
public String getTimestamp() {
  return (new Date()).toString();
}
Programming Problem (3)
   Run your web server and mount an attack that
    defaces the index.html home page.
   Assume that the web server is run as root on a
    Linux workstation. Mount an attack against
    SimpleWebServer in which you take
    ownership of the machine that it is running on.
    By taking ownership, we mean that you should
    be able to gain access to a root account, giving
    you unrestricted access to all the resources on
    the system. Be sure to cover your tracks so that
    the web log does not indicate that you mounted
    an attack.

More Related Content

What's hot

Ns 3 installation procedure
Ns 3 installation procedureNs 3 installation procedure
Ns 3 installation procedureVinayak Antin
 
Geek Sync | Using PowerShell with Python and SQL Server
Geek Sync | Using PowerShell with Python and SQL ServerGeek Sync | Using PowerShell with Python and SQL Server
Geek Sync | Using PowerShell with Python and SQL ServerIDERA Software
 
5. configuring multiple switch with files
5. configuring multiple switch with files5. configuring multiple switch with files
5. configuring multiple switch with filesVishnu Vardhan
 
How to configure multiple PostgreSQL-9
How to configure multiple PostgreSQL-9How to configure multiple PostgreSQL-9
How to configure multiple PostgreSQL-9Vivek Singh
 
Depende, ¿de qué depende? - Plain Concepts Dev Day
Depende, ¿de qué depende? - Plain Concepts Dev Day Depende, ¿de qué depende? - Plain Concepts Dev Day
Depende, ¿de qué depende? - Plain Concepts Dev Day Plain Concepts
 
Strayer cis-273-week-2-lab-assignment-1-beginning-html-new
Strayer cis-273-week-2-lab-assignment-1-beginning-html-newStrayer cis-273-week-2-lab-assignment-1-beginning-html-new
Strayer cis-273-week-2-lab-assignment-1-beginning-html-newkrystalhero123
 
Mastering the MongoDB Javascript Shell
Mastering the MongoDB Javascript ShellMastering the MongoDB Javascript Shell
Mastering the MongoDB Javascript ShellScott Hernandez
 
[OpenTRS-001] ooops
[OpenTRS-001] ooops[OpenTRS-001] ooops
[OpenTRS-001] ooopsTheori
 
Xitrum internals
Xitrum internalsXitrum internals
Xitrum internalsNgoc Dao
 
Introduction to Exploitation
Introduction to ExploitationIntroduction to Exploitation
Introduction to Exploitationprimeteacher32
 
Secpanel | Simple to use security tool for linux servers
Secpanel | Simple to use security tool for linux serversSecpanel | Simple to use security tool for linux servers
Secpanel | Simple to use security tool for linux serversRudhir Sharan
 
Terminalcommandsubuntu1 170123133631 (1)
Terminalcommandsubuntu1 170123133631 (1)Terminalcommandsubuntu1 170123133631 (1)
Terminalcommandsubuntu1 170123133631 (1)SteveEvans551344
 

What's hot (20)

Codigo java
Codigo javaCodigo java
Codigo java
 
Ns 3 installation procedure
Ns 3 installation procedureNs 3 installation procedure
Ns 3 installation procedure
 
Geek Sync | Using PowerShell with Python and SQL Server
Geek Sync | Using PowerShell with Python and SQL ServerGeek Sync | Using PowerShell with Python and SQL Server
Geek Sync | Using PowerShell with Python and SQL Server
 
Intro to Exploitation
Intro to ExploitationIntro to Exploitation
Intro to Exploitation
 
Storm introduction
Storm introductionStorm introduction
Storm introduction
 
5. configuring multiple switch with files
5. configuring multiple switch with files5. configuring multiple switch with files
5. configuring multiple switch with files
 
How to configure multiple PostgreSQL-9
How to configure multiple PostgreSQL-9How to configure multiple PostgreSQL-9
How to configure multiple PostgreSQL-9
 
Depende, ¿de qué depende? - Plain Concepts Dev Day
Depende, ¿de qué depende? - Plain Concepts Dev Day Depende, ¿de qué depende? - Plain Concepts Dev Day
Depende, ¿de qué depende? - Plain Concepts Dev Day
 
Strayer cis-273-week-2-lab-assignment-1-beginning-html-new
Strayer cis-273-week-2-lab-assignment-1-beginning-html-newStrayer cis-273-week-2-lab-assignment-1-beginning-html-new
Strayer cis-273-week-2-lab-assignment-1-beginning-html-new
 
A little waf
A little wafA little waf
A little waf
 
Mastering the MongoDB Javascript Shell
Mastering the MongoDB Javascript ShellMastering the MongoDB Javascript Shell
Mastering the MongoDB Javascript Shell
 
[OpenTRS-001] ooops
[OpenTRS-001] ooops[OpenTRS-001] ooops
[OpenTRS-001] ooops
 
Enumeration
EnumerationEnumeration
Enumeration
 
Xitrum internals
Xitrum internalsXitrum internals
Xitrum internals
 
Introduction to Exploitation
Introduction to ExploitationIntroduction to Exploitation
Introduction to Exploitation
 
Windows Security Crash Course
Windows Security Crash CourseWindows Security Crash Course
Windows Security Crash Course
 
Secpanel | Simple to use security tool for linux servers
Secpanel | Simple to use security tool for linux serversSecpanel | Simple to use security tool for linux servers
Secpanel | Simple to use security tool for linux servers
 
Terminalcommandsubuntu1 170123133631 (1)
Terminalcommandsubuntu1 170123133631 (1)Terminalcommandsubuntu1 170123133631 (1)
Terminalcommandsubuntu1 170123133631 (1)
 
File io
File io File io
File io
 
Retro vs volley (2)
Retro vs volley (2)Retro vs volley (2)
Retro vs volley (2)
 

Viewers also liked

Agile and the nature of decision making
Agile and the nature of decision makingAgile and the nature of decision making
Agile and the nature of decision makingdrewz lin
 
15 ma cs and signatures
15   ma cs and signatures15   ma cs and signatures
15 ma cs and signaturesdrewz lin
 
Test design problems investigation taixiaomei 20120807
Test design problems investigation taixiaomei 20120807Test design problems investigation taixiaomei 20120807
Test design problems investigation taixiaomei 20120807drewz lin
 
Hands onagile2012shared
Hands onagile2012sharedHands onagile2012shared
Hands onagile2012shareddrewz lin
 
敏捷模式下的百度研发基础环境建设 1
敏捷模式下的百度研发基础环境建设 1敏捷模式下的百度研发基础环境建设 1
敏捷模式下的百度研发基础环境建设 1drewz lin
 
豆瓣I os自动化测试实践和经验
豆瓣I os自动化测试实践和经验豆瓣I os自动化测试实践和经验
豆瓣I os自动化测试实践和经验drewz lin
 
Simple methods for_reliable_user_involvement
Simple methods for_reliable_user_involvementSimple methods for_reliable_user_involvement
Simple methods for_reliable_user_involvementdrewz lin
 
Tcpcopy 阿里技术沙龙
Tcpcopy 阿里技术沙龙Tcpcopy 阿里技术沙龙
Tcpcopy 阿里技术沙龙drewz lin
 
Top100summit 互联网发布与实验体系建设
Top100summit 互联网发布与实验体系建设 Top100summit 互联网发布与实验体系建设
Top100summit 互联网发布与实验体系建设 drewz lin
 

Viewers also liked (9)

Agile and the nature of decision making
Agile and the nature of decision makingAgile and the nature of decision making
Agile and the nature of decision making
 
15 ma cs and signatures
15   ma cs and signatures15   ma cs and signatures
15 ma cs and signatures
 
Test design problems investigation taixiaomei 20120807
Test design problems investigation taixiaomei 20120807Test design problems investigation taixiaomei 20120807
Test design problems investigation taixiaomei 20120807
 
Hands onagile2012shared
Hands onagile2012sharedHands onagile2012shared
Hands onagile2012shared
 
敏捷模式下的百度研发基础环境建设 1
敏捷模式下的百度研发基础环境建设 1敏捷模式下的百度研发基础环境建设 1
敏捷模式下的百度研发基础环境建设 1
 
豆瓣I os自动化测试实践和经验
豆瓣I os自动化测试实践和经验豆瓣I os自动化测试实践和经验
豆瓣I os自动化测试实践和经验
 
Simple methods for_reliable_user_involvement
Simple methods for_reliable_user_involvementSimple methods for_reliable_user_involvement
Simple methods for_reliable_user_involvement
 
Tcpcopy 阿里技术沙龙
Tcpcopy 阿里技术沙龙Tcpcopy 阿里技术沙龙
Tcpcopy 阿里技术沙龙
 
Top100summit 互联网发布与实验体系建设
Top100summit 互联网发布与实验体系建设 Top100summit 互联网发布与实验体系建设
Top100summit 互联网发布与实验体系建设
 

Similar to CHAPTER 4 Exercises for Part 1 Security Concepts

Secure erasure code based cloud storage system with secure data forwarding
Secure erasure code based cloud storage system with secure data forwardingSecure erasure code based cloud storage system with secure data forwarding
Secure erasure code based cloud storage system with secure data forwardingPriyank Rupera
 
Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java Baruch Sadogursky
 
Layer 7 ddos
Layer 7 ddosLayer 7 ddos
Layer 7 ddosfangjiafu
 
15 Text files
15 Text files15 Text files
15 Text filesmaznabili
 
Cm8 secure code_training_1day_security libraries
Cm8 secure code_training_1day_security librariesCm8 secure code_training_1day_security libraries
Cm8 secure code_training_1day_security librariesdcervigni
 
Writing Swift code with great testability
Writing Swift code with great testabilityWriting Swift code with great testability
Writing Swift code with great testabilityJohn Sundell
 
3 secure design principles
3   secure design principles3   secure design principles
3 secure design principlesdrewz lin
 
file-transfer-using-tcp.pdf
file-transfer-using-tcp.pdffile-transfer-using-tcp.pdf
file-transfer-using-tcp.pdfJayaprasanna4
 
Application and Website Security -- Fundamental Edition
Application and Website Security -- Fundamental EditionApplication and Website Security -- Fundamental Edition
Application and Website Security -- Fundamental EditionDaniel Owens
 
Web-servers & Application Hacking
Web-servers & Application HackingWeb-servers & Application Hacking
Web-servers & Application HackingRaghav Bisht
 
Session9-File Upload Security
Session9-File Upload SecuritySession9-File Upload Security
Session9-File Upload Securityzakieh alizadeh
 
OpenStack Security Project
OpenStack Security ProjectOpenStack Security Project
OpenStack Security ProjectTravis McPeak
 
File Handling in Java.pdf
File Handling in Java.pdfFile Handling in Java.pdf
File Handling in Java.pdfSudhanshiBakre1
 
Watir Presentation Sumanth Krishna. A
Watir Presentation   Sumanth Krishna. AWatir Presentation   Sumanth Krishna. A
Watir Presentation Sumanth Krishna. ASumanth krishna
 
Reusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modulesReusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modulesYevgeniy Brikman
 

Similar to CHAPTER 4 Exercises for Part 1 Security Concepts (20)

Secure erasure code based cloud storage system with secure data forwarding
Secure erasure code based cloud storage system with secure data forwardingSecure erasure code based cloud storage system with secure data forwarding
Secure erasure code based cloud storage system with secure data forwarding
 
About Node.js
About Node.jsAbout Node.js
About Node.js
 
Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java
 
Ondemand scaling-aws
Ondemand scaling-awsOndemand scaling-aws
Ondemand scaling-aws
 
Layer 7 ddos
Layer 7 ddosLayer 7 ddos
Layer 7 ddos
 
Java file
Java fileJava file
Java file
 
15 Text files
15 Text files15 Text files
15 Text files
 
Cm8 secure code_training_1day_security libraries
Cm8 secure code_training_1day_security librariesCm8 secure code_training_1day_security libraries
Cm8 secure code_training_1day_security libraries
 
Writing Swift code with great testability
Writing Swift code with great testabilityWriting Swift code with great testability
Writing Swift code with great testability
 
ExtraFileIO.pptx
ExtraFileIO.pptxExtraFileIO.pptx
ExtraFileIO.pptx
 
3 secure design principles
3   secure design principles3   secure design principles
3 secure design principles
 
Java I/o streams
Java I/o streamsJava I/o streams
Java I/o streams
 
file-transfer-using-tcp.pdf
file-transfer-using-tcp.pdffile-transfer-using-tcp.pdf
file-transfer-using-tcp.pdf
 
Application and Website Security -- Fundamental Edition
Application and Website Security -- Fundamental EditionApplication and Website Security -- Fundamental Edition
Application and Website Security -- Fundamental Edition
 
Web-servers & Application Hacking
Web-servers & Application HackingWeb-servers & Application Hacking
Web-servers & Application Hacking
 
Session9-File Upload Security
Session9-File Upload SecuritySession9-File Upload Security
Session9-File Upload Security
 
OpenStack Security Project
OpenStack Security ProjectOpenStack Security Project
OpenStack Security Project
 
File Handling in Java.pdf
File Handling in Java.pdfFile Handling in Java.pdf
File Handling in Java.pdf
 
Watir Presentation Sumanth Krishna. A
Watir Presentation   Sumanth Krishna. AWatir Presentation   Sumanth Krishna. A
Watir Presentation Sumanth Krishna. A
 
Reusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modulesReusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modules
 

More from drewz lin

Web security-–-everything-we-know-is-wrong-eoin-keary
Web security-–-everything-we-know-is-wrong-eoin-kearyWeb security-–-everything-we-know-is-wrong-eoin-keary
Web security-–-everything-we-know-is-wrong-eoin-kearydrewz lin
 
Via forensics appsecusa-nov-2013
Via forensics appsecusa-nov-2013Via forensics appsecusa-nov-2013
Via forensics appsecusa-nov-2013drewz lin
 
Phu appsec13
Phu appsec13Phu appsec13
Phu appsec13drewz lin
 
Owasp2013 johannesullrich
Owasp2013 johannesullrichOwasp2013 johannesullrich
Owasp2013 johannesullrichdrewz lin
 
Owasp advanced mobile-application-code-review-techniques-v0.2
Owasp advanced mobile-application-code-review-techniques-v0.2Owasp advanced mobile-application-code-review-techniques-v0.2
Owasp advanced mobile-application-code-review-techniques-v0.2drewz lin
 
I mas appsecusa-nov13-v2
I mas appsecusa-nov13-v2I mas appsecusa-nov13-v2
I mas appsecusa-nov13-v2drewz lin
 
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolf
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolfDefeating xss-and-xsrf-with-my faces-frameworks-steve-wolf
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolfdrewz lin
 
Csrf not-all-defenses-are-created-equal
Csrf not-all-defenses-are-created-equalCsrf not-all-defenses-are-created-equal
Csrf not-all-defenses-are-created-equaldrewz lin
 
Chuck willis-owaspbwa-beyond-1.0-app secusa-2013-11-21
Chuck willis-owaspbwa-beyond-1.0-app secusa-2013-11-21Chuck willis-owaspbwa-beyond-1.0-app secusa-2013-11-21
Chuck willis-owaspbwa-beyond-1.0-app secusa-2013-11-21drewz lin
 
Appsec usa roberthansen
Appsec usa roberthansenAppsec usa roberthansen
Appsec usa roberthansendrewz lin
 
Appsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaolaAppsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaoladrewz lin
 
Appsec2013 presentation-dickson final-with_all_final_edits
Appsec2013 presentation-dickson final-with_all_final_editsAppsec2013 presentation-dickson final-with_all_final_edits
Appsec2013 presentation-dickson final-with_all_final_editsdrewz lin
 
Appsec2013 presentation
Appsec2013 presentationAppsec2013 presentation
Appsec2013 presentationdrewz lin
 
Appsec 2013-krehel-ondrej-forensic-investigations-of-web-exploitations
Appsec 2013-krehel-ondrej-forensic-investigations-of-web-exploitationsAppsec 2013-krehel-ondrej-forensic-investigations-of-web-exploitations
Appsec 2013-krehel-ondrej-forensic-investigations-of-web-exploitationsdrewz lin
 
Appsec2013 assurance tagging-robert martin
Appsec2013 assurance tagging-robert martinAppsec2013 assurance tagging-robert martin
Appsec2013 assurance tagging-robert martindrewz lin
 
Amol scadaowasp
Amol scadaowaspAmol scadaowasp
Amol scadaowaspdrewz lin
 
Agile sdlc-v1.1-owasp-app sec-usa
Agile sdlc-v1.1-owasp-app sec-usaAgile sdlc-v1.1-owasp-app sec-usa
Agile sdlc-v1.1-owasp-app sec-usadrewz lin
 
Vulnex app secusa2013
Vulnex app secusa2013Vulnex app secusa2013
Vulnex app secusa2013drewz lin
 
基于虚拟化技术的分布式软件测试框架
基于虚拟化技术的分布式软件测试框架基于虚拟化技术的分布式软件测试框架
基于虚拟化技术的分布式软件测试框架drewz lin
 
新浪微博稳定性经验谈
新浪微博稳定性经验谈新浪微博稳定性经验谈
新浪微博稳定性经验谈drewz lin
 

More from drewz lin (20)

Web security-–-everything-we-know-is-wrong-eoin-keary
Web security-–-everything-we-know-is-wrong-eoin-kearyWeb security-–-everything-we-know-is-wrong-eoin-keary
Web security-–-everything-we-know-is-wrong-eoin-keary
 
Via forensics appsecusa-nov-2013
Via forensics appsecusa-nov-2013Via forensics appsecusa-nov-2013
Via forensics appsecusa-nov-2013
 
Phu appsec13
Phu appsec13Phu appsec13
Phu appsec13
 
Owasp2013 johannesullrich
Owasp2013 johannesullrichOwasp2013 johannesullrich
Owasp2013 johannesullrich
 
Owasp advanced mobile-application-code-review-techniques-v0.2
Owasp advanced mobile-application-code-review-techniques-v0.2Owasp advanced mobile-application-code-review-techniques-v0.2
Owasp advanced mobile-application-code-review-techniques-v0.2
 
I mas appsecusa-nov13-v2
I mas appsecusa-nov13-v2I mas appsecusa-nov13-v2
I mas appsecusa-nov13-v2
 
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolf
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolfDefeating xss-and-xsrf-with-my faces-frameworks-steve-wolf
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolf
 
Csrf not-all-defenses-are-created-equal
Csrf not-all-defenses-are-created-equalCsrf not-all-defenses-are-created-equal
Csrf not-all-defenses-are-created-equal
 
Chuck willis-owaspbwa-beyond-1.0-app secusa-2013-11-21
Chuck willis-owaspbwa-beyond-1.0-app secusa-2013-11-21Chuck willis-owaspbwa-beyond-1.0-app secusa-2013-11-21
Chuck willis-owaspbwa-beyond-1.0-app secusa-2013-11-21
 
Appsec usa roberthansen
Appsec usa roberthansenAppsec usa roberthansen
Appsec usa roberthansen
 
Appsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaolaAppsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaola
 
Appsec2013 presentation-dickson final-with_all_final_edits
Appsec2013 presentation-dickson final-with_all_final_editsAppsec2013 presentation-dickson final-with_all_final_edits
Appsec2013 presentation-dickson final-with_all_final_edits
 
Appsec2013 presentation
Appsec2013 presentationAppsec2013 presentation
Appsec2013 presentation
 
Appsec 2013-krehel-ondrej-forensic-investigations-of-web-exploitations
Appsec 2013-krehel-ondrej-forensic-investigations-of-web-exploitationsAppsec 2013-krehel-ondrej-forensic-investigations-of-web-exploitations
Appsec 2013-krehel-ondrej-forensic-investigations-of-web-exploitations
 
Appsec2013 assurance tagging-robert martin
Appsec2013 assurance tagging-robert martinAppsec2013 assurance tagging-robert martin
Appsec2013 assurance tagging-robert martin
 
Amol scadaowasp
Amol scadaowaspAmol scadaowasp
Amol scadaowasp
 
Agile sdlc-v1.1-owasp-app sec-usa
Agile sdlc-v1.1-owasp-app sec-usaAgile sdlc-v1.1-owasp-app sec-usa
Agile sdlc-v1.1-owasp-app sec-usa
 
Vulnex app secusa2013
Vulnex app secusa2013Vulnex app secusa2013
Vulnex app secusa2013
 
基于虚拟化技术的分布式软件测试框架
基于虚拟化技术的分布式软件测试框架基于虚拟化技术的分布式软件测试框架
基于虚拟化技术的分布式软件测试框架
 
新浪微博稳定性经验谈
新浪微博稳定性经验谈新浪微博稳定性经验谈
新浪微博稳定性经验谈
 

CHAPTER 4 Exercises for Part 1 Security Concepts

  • 1. CHAPTER 4 Exercises for Part 1 Slides adapted from "Foundations of Security: What Every Programmer Needs To Know" by Neil Daswani, Christoph Kern, and Anita Kesavan (ISBN 1590597842; http://www.foundationsofsecurity.com). Except as otherwise noted, the content of this presentation is licensed under the Creative Commons 3.0 License.
  • 2. Conceptual Exercises  Are there dependencies between any of the security concepts that we covered? For example, is authentication required for authorization? Why or why not?  What happens if a client connects to SimpleWebServer, but never sends any data and never disconnects? What type of an attack would such a client be able to conduct?
  • 3. Programming Problem (1)  HTTP supports a mechanism that allows users to upload files in addition to retrieving them through a PUT command.  What threats would you need to consider if SimpleWebServer also had functionality that could be used to upload files?  For each of the specific threats you just listed, what types of security mechanisms might you put in place to mitigate the threats?
  • 4. Programming Problem (2) public void storeFile (BufferedReader br, OutputStreamWriter osw, String pathname) throws Exception { FileWriter fw = null; try { fw = new FileWriter(pathname);  Modify the String s = br.readLine(); while (s != null) { processRequest() fw.write(s); s = br.readLine(); method in SWS to } fw.close(); use this file storage osw.write("HTTP/1.0 201 Created"); } catch(Exception e) { and logging code. osw.write("HTTP/1.0 500 Internal Server Error"); } } public void logEntry(String filename,String record) { FileWriter fw = new FileWriter (filename, true); fw.write(getTimestamp()+ " " + record); fw.close(); } public String getTimestamp() { return (new Date()).toString(); }
  • 5. Programming Problem (3)  Run your web server and mount an attack that defaces the index.html home page.  Assume that the web server is run as root on a Linux workstation. Mount an attack against SimpleWebServer in which you take ownership of the machine that it is running on. By taking ownership, we mean that you should be able to gain access to a root account, giving you unrestricted access to all the resources on the system. Be sure to cover your tracks so that the web log does not indicate that you mounted an attack.

Editor's Notes

  1. Welcome to SEC103 on Secure Programming Techniques. In this course, I assume that you have some background in computer security, but now you want to put that background to use. For example, in the Computer Security Principles and Introduction To Cryptography courses, we cover topics such concerning trust and encryption. In this course, we put these principles into to practice, and I’ll show you have to write secure code that builds security into your applications from the ground up.