Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ISI-TP2-injection
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Birlouez
ISI-TP2-injection
Commits
1593e47f
Commit
1593e47f
authored
3 years ago
by
martin.birlouez.etu
Browse files
Options
Downloads
Patches
Plain Diff
Q4
parent
a0e34311
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
rendu.md
+9
-2
9 additions, 2 deletions
rendu.md
serveur_correct.py
+2
-2
2 additions, 2 deletions
serveur_correct.py
with
11 additions
and
4 deletions
rendu.md
+
9
−
2
View file @
1593e47f
...
@@ -43,8 +43,15 @@ curl -X POST -F "chaine=Drop','8.8.8.8'); DELETE chaine WHERE 1=1 #" localhost:8
...
@@ -43,8 +43,15 @@ curl -X POST -F "chaine=Drop','8.8.8.8'); DELETE chaine WHERE 1=1 #" localhost:8
## Question 4
## Question 4
Rendre un fichier server_correct.py avec la correction de la faille de
On corrige cette faille avec la ligne suivante :
sécurité. Expliquez comment vous avez corrigé la faille.
```
py
requete
=
"
INSERT INTO chaines (txt,who) VALUES( %s , %s )
"
v
=
(
post
[
"
chaine
"
],
cherrypy
.
request
.
remote
.
ip
)
cursor
.
execute
(
requete
,
v
)
```
La 1er ligne est la pour créé des requetes paramétrique et cette requette prend les parametre dans un scegond temps aprés
une verification par la librairei python.
## Question 5
## Question 5
...
...
This diff is collapsed.
Click to expand it.
server_correct.py
→
serve
u
r_correct.py
+
2
−
2
View file @
1593e47f
...
@@ -12,14 +12,14 @@ class VulnerableApp(object):
...
@@ -12,14 +12,14 @@ class VulnerableApp(object):
def
index
(
self
,
**
post
):
def
index
(
self
,
**
post
):
cursor
=
self
.
conn
.
cursor
()
cursor
=
self
.
conn
.
cursor
()
if
cherrypy
.
request
.
method
==
"
POST
"
:
if
cherrypy
.
request
.
method
==
"
POST
"
:
requete
=
""
"
INSERT INTO chaines (txt,who) VALUES( %s , %s )
"
""
requete
=
"
INSERT INTO chaines (txt,who) VALUES( %s , %s )
"
v
=
(
post
[
"
chaine
"
],
cherrypy
.
request
.
remote
.
ip
)
v
=
(
post
[
"
chaine
"
],
cherrypy
.
request
.
remote
.
ip
)
print
(
"
req: [
"
+
requete
+
"
]
"
)
print
(
"
req: [
"
+
requete
+
"
]
"
)
cursor
.
execute
(
requete
,
v
)
cursor
.
execute
(
requete
,
v
)
self
.
conn
.
commit
()
self
.
conn
.
commit
()
chaines
=
[]
chaines
=
[]
cursor
.
execute
(
"
SELECT txt,who FROM chaines
"
)
;
cursor
.
execute
(
"
SELECT txt,who FROM chaines
"
)
for
row
in
cursor
.
fetchall
():
for
row
in
cursor
.
fetchall
():
chaines
.
append
(
row
[
0
]
+
"
envoye par:
"
+
row
[
1
])
chaines
.
append
(
row
[
0
]
+
"
envoye par:
"
+
row
[
1
])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment