CMSC 433 Homework 4: Testing BoundedAtomicQueue and Security Best Practices - Prof. Willia, Assignments of Programming Languages

Instructions for a university computer science homework assignment focusing on testing the atomicity, fairness, and correct size of a concurrent data structure called boundedatomicqueue, as well as identifying security vulnerabilities in given code snippets. Topics include buffer overflows, format string attacks, and sql injection.

Typology: Assignments

Pre 2010

Uploaded on 07/30/2009

koofers-user-d41
koofers-user-d41 🇺🇸

10 documents

1 / 43

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CMSC 433
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b

Partial preview of the text

Download CMSC 433 Homework 4: Testing BoundedAtomicQueue and Security Best Practices - Prof. Willia and more Assignments Programming Languages in PDF only on Docsity!

  • CMSC

Homework 4

  • write test cases for BoundedAtomicQueue, using MultithreadedTC
  • Should be atomic, fair, and the correct size
  • You are given a correct implementation, and 4 broken implementations
  • Write test cases that distinguish them
  • Everything open, no release tests
    • this is a homework, not a project
  • Due Friday Nov 16th

Upcoming stuff

  • WebGoat security homework
  • Distributed programming
    • Map/Reduce and Hadoop

Timing notes

  • Turns out, OSX is way better than most other operating systems by default
  • On OSX (as least on Leopard), Java Thread.sleep resolution is 1 millisecond
  • On many other platforms, it is 10 milliseconds or 16 milliseconds
  • Had to adjust tests cases to fit
  • Project 4

Software Security

  • Making sure that if your software is misused, it doesn’t do any of the vast number of things you didn’t intend for the software to do

On trusting trust

  • You can hide a trojan horse in a compiler - or in the operating system

Slightly cool, but not very

interesting

  • Get spotted in a code audit

Compiler

Code generateCode(AST method) { if (method.getName() .equals(“authenticateLogin”)) { return .. code with trap door.. } if (method.getName() .equals(“generateCode”)) { return ... code with special code gen ...; } .. generate code normally }

Software defects

  • Traditional approach to correctness
    • define precondition
    • show that if precondition satisfied, output satisfied postcondition
  • Didn’t examine what happened if input didn’t satisfy precondition

#1 source of security defects

  • Untrusted, unverified and unexpected input leading to a program doing something completely unexpected - unexpected by developer - intended by attacker
  • of all the untrusted input problems, # 1 is buffer overruns in C/C++.

Stack layout

int main(int argc, char *argv[]) { int value; char buf1[80]; … } argv argc return address frame pointer buf value

gets() is evil

  • Impossible to use gets() correctly char buf[20]; gets(buf);

C String functions

char buf[20]; char * prefix = “http://”; strcpy(buf,prefix); strncat(buf, path, sizeof(buf) - strlen(buf));

sprintf

  • char buf[80]; sprintf(buf, “%s - %d\n”, path, errno);