Question

Question 14 (7 marks) Marilyn Monroe, a recent graduate from another university, has not had the benefit of education in secure coding techniques. In her first job, coding an e-commerce site, she writes the following PHP code: $querySELECT FROM customers WHERE acctno -. POST[acctno]. ; $result - $conn->query ($query); a. (1 mark) What has she done wrong? b. (4 marks) Describe two ways of fixing this problem. (2 marks) Give an example of the type of account number value an attacker could use to test whether the system is exploitable. *c.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1. She is directly using user input on the query without sanitizing it. Attacker may not always send the correct value, he may send some value which can be harmful to the system.

----------------------

2. TO fix the issue, one can either manually sanitize the user input, like, do not allow special characters like quotes etc and sanitize user input to whatever can be valid. Other way would be: To use prepared statement, PDO or MysqlI, which are safe to be executed.
----------------------
3.

If the attacker gives a string like below:
$_POST['acctno'] = "a' or '1'='1"

The wholoe query would become:
SELECT * FROM Customers where acctno = 'a' or '1'='1'

note that even if the first clause is not matching, second clause will match for all the rows.. So this query would return all the user accounts, which is a data leak.

----------------------

Thanks!

Add a comment
Know the answer?
Add Answer to:
Question 14 (7 marks) Marilyn Monroe, a recent graduate from another university, has not had the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • First, read the article on "The Delphi Method for Graduate Research." ------ Article is posted below...

    First, read the article on "The Delphi Method for Graduate Research." ------ Article is posted below Include each of the following in your answer (if applicable – explain in a paragraph) Research problem: what do you want to solve using Delphi? Sample: who will participate and why? (answer in 5 -10 sentences) Round one questionnaire: include 5 hypothetical questions you would like to ask Discuss: what are possible outcomes of the findings from your study? Hint: this is the conclusion....

  • Please read the article bellow and discuss the shift in the company's approach to genetic analysis....

    Please read the article bellow and discuss the shift in the company's approach to genetic analysis. Please also discuss what you think about personal genomic companies' approaches to research. Feel free to compare 23andMe's polices on research with another company's. Did you think the FDA was right in prohibiting 23andMe from providing health information? These are some sample talking points to get you thinking about the ethics of genetic research in the context of Big Data. You don't have to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT