Question
Suppose that John writes the following php script to access his database. He is worried that the script can be read by an adversary and
Suppose that John writes the following php script to access his database.
He is worried that the script can be read by an adversary and he wants to protect the login information. Given that this script is only accessed by an administrator, John decides to write code that places a magic value within the cookie of the administrator and then somehow use this value to hide all critical information in the above PHP script (specifically the raw value of $username and $password). Note that the magic value can be accessed from within the script in the following way: _COOKIE[mymagic] a) Write a modified PHP script that achieves Johns objective. Explain what the magic value will be. b) What is the main defect of Johns approach? c) What would be a better way to achieve Johns objective?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started