I have read somewhere here that using prepared statements in PDO makes your app only immune to first order SQL injections, but not totally immune to second order injections.
My question is: if we used prepared statements in all queries inlcuding SELECT queries and not only in INSERT query, then how can a second order sql injection be possible?
For example in the following queries there is no chance for a 2nd order injection:
write:
INSERT INTO posts (userID,text,date) VALUES(?,?,?)
read:
SELECT * FROM posts WEHRE userID=?
delete:
DELETE FROM posts WHERE userID=?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…