Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 2 : Write a series of attacks against our insecure reference monitors. . Requirement 1 : You will need to write one or more

Part 2: Write a series of attacks against our insecure reference monitors.
.Requirement 1: You will need to write one or more attack files which successfully circumvent each of the reference monitors we have defined. A successful attack is one where you are able to circumvent the requirements from part 1. Examples include causing an invalid file to be saved, reading the "write to" file, or writing to the backup file we read from. In general abusing any functionality and causing the reference monitor to behave the way it was not supposed to. Preferably with an advantage to an attacker.
Requirement 2: Do NOT trigger the secure reference monitor. This monitor is not susceptible to any known attacks. If your attack against this monitor returns true, it is likely an error in the logic and not because your attack was successful. This will also earn you -10 points on this portion until you correct your code.
In this assignment you will learn how to attack a reference monitor. The reference monitor you will be testing uses the security layer framework (encasement library, etc.) for the Seattle testbed. It is possible to do this assignment separately, but it is recommended that this assignment be completed after Part One.
You will submit a zip file containing all of the tests you have created. You will gain points for every student's reference monitor you find a flaw in. It is good if multiple tests of yours break a student's reference monitor, but you gain the same number of tests whether one or more tests break the layer.
The result of my tests:
Tests on a working reference monitor that has an issue with threading defenses. (0/13.5)
Tests on a working reference monitor that has an issue with file lengths. (0/13.5)
Tests on a barely working reference monitor that tests bare functionality. (0/9)
Tests on a working reference monitor that has poor defenses. (0/9)
Below is another example of a test case you may want to consider.
# New File Operation
# Clean up of existing file
if "testfile.txt.a" in listfiles():
removefile("testfile.txt.a")
if "testfile.txt.b" in listfiles():
removefile("testfile.txt.b")
# Open File Function Call
myfile=ABopenfile("testfile.txt",True) #Create an AB file
try:
# Empty/New File should have contents 'SE' satisfying the requirement
assert('SE'== myfile.readat(2,0))
# Close the file:
myfile.close()
except:
myfile.close()
# Error Handle or Failure Condition
log("Empty file is not handled properly!")
The reference monitor from Part One:
class ABFile():
def __init__(self,filename,create):
# globals
mycontext['debug']= False
# local (per object) reference to the underlying file
self.Afn = filename+'.a'
self.Bfn = filename+'.b'
self.length =0
#Make the files and add 'SE' to the Readat file...
if create:
if self.Afn in listfiles():
self.Afile = openfile(self.Afn,create)
self.Bfile = openfile(self.Bfn,create)
self.Bfile.writeat(self.Afile.readat(None,0),0)
else:
self.Afile = openfile(self.Afn,create)
self.Bfile = openfile(self.Bfn,create)
self.Afile.writeat('SE',0)
else:
if self.Afn in listfiles():
self.Afile = openfile(self.Afn,True)
self.Bfile = openfile(self.Bfn,True)
self.Bfile.writeat(self.Afile.readat(None,0),0)
else:
raise FileNotFoundError
def writeat(self,data,offset):
file_size = len(self.Bfile.readat(None,0))
# Check for invalid writes
if offset > file_size:
self.Bfile.writeat('\x00'*(offset - file_size), file_size)
self.Bfile.writeat(data,offset)
def readat(self,bytes,offset):
# Read from the A file using the sandbox's readat...
data = self.Afile.readat(bytes,offset)
return data
def close(self):
if(is_valid_content(self.Afile) and is_valid_content(self.Bfile)):
copy1= self.Bfile.readat(None,0)
self.Afile.writeat(copy1,0)
# if a file is not valid then we will discard it i.e replace B file with A file.
else:
copy2= self.Afile.readat(None,0)
self.Bfile.writeat(copy2,0)
self.Afile.close()
self.Bfile.close()
def ABopenfile(filename, create):
# First method that is called in the reference monitor when a file is opened.
return ABFile(filename,create)
def is_valid_content(file):
first_char = file.readat(1,0)
if (first_char =='S'):
i =0
try:
while(True):
file_size = file.readat(1,i)
i = i +1
except Exception as e:
last_char = file.readat(1,i-2)
if (last_char =='E'):
return True
else:
return False

Step by Step Solution

There are 3 Steps involved in it

Step: 1

The question is incomplete because it involves writing a detailed series of attacks against insecure reference monitors without further context or exp... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

How did you feel about taking piano lessons as a child? (general)

Answered: 1 week ago