Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a) Advance the remote code injection we saw in class as follows: Craft and test a malicious Python2.x payload that allows an attacker to detect

a) Advance the remote code injection we saw in class as follows:  Craft and test a malicious Python2.x payload that allows an attacker to detect the target operating system (e.g., Linux, Win32, ...). Note: in the examples given in class, the attack payloads were done with the assumption that the target host is a Linux OS. For this part, you need to be creative as to how to embed a longer (multi-line) Python2.x  payload in your inputs to agent.py. Explore options such as exec, eval, ...

b) The root cause of the injection vulnerability for agent.py is the lack of input sanitization and/or validation when the input () function is used to read inputs. Modify agent.py such that it performs input sanitization and/or validation before it uses user input in its application logic. Show how your input sanitization handles common injection cases like the ones we tried in class.

Notes:

  • Assume the code is executed by Python2.x interpreter (the same assumption we took in class). Don't try any of these in Python 3.x (understandably fixed in the later versions of Python).
  • You are free to research possible ideas but make sure that you cite your sources whenever an idea is not yours.

 

Submission:

  • For a), submit the exploit payload (.txt) that goes as input to the  undefended (i.e., without input sanitization) agent.py
  • For b), submit a modified agent.py file with the implementations of your input sanitization and/or validation countermeasures.
  • =======agent.py======

    import random
    import hashlib

    secret = 'this is a secret'
    public = 'to buy a house.'
    value =input('Enter number of customers: ')
    print "There are", value,
    print "customers looking", public

    =======================


Step by Step Solution

There are 3 Steps involved in it

Step: 1

a Advancing the remote code injection in agentpy requires crafting and testing a malicious Python2x payload that allows an attacker to detect the targ... 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

Principles Of Information Security

Authors: Michael E. Whitman, Herbert J. Mattord

7th Edition

035750643X, 978-0357506431

More Books

Students also viewed these Programming questions

Question

=+6. Discuss the concept of value as applied to digital marketing

Answered: 1 week ago