Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swen90006-a2-2018
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
Model registry
Operate
Environments
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
Callum Bradshaw
swen90006-a2-2018
Commits
8be782ee
Commit
8be782ee
authored
Oct 12, 2018
by
ryuzakighost
Browse files
Options
Downloads
Patches
Plain Diff
vuln attmept 2
parent
fef4659f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
fuzzer/Fuzzer.java
+3
-5
3 additions, 5 deletions
fuzzer/Fuzzer.java
src/machine-vuln1.c
+6
-2
6 additions, 2 deletions
src/machine-vuln1.c
with
9 additions
and
7 deletions
fuzzer/Fuzzer.java
+
3
−
5
View file @
8be782ee
...
@@ -21,10 +21,8 @@ public class Fuzzer {
...
@@ -21,10 +21,8 @@ public class Fuzzer {
/* We just print one instruction.
/* We just print one instruction.
Hint: you might want to make use of the instruction
Hint: you might want to make use of the instruction
grammar which is effectively encoded in Instruction.java */
grammar which is effectively encoded in Instruction.java */
pw
.
println
(
"MOV R1 1"
);
pw
.
println
(
"MOV R0 65535"
);
pw
.
println
(
"MOV R2 0"
);
pw
.
println
(
"LDR R2 R0 0"
);
pw
.
println
(
"DIV R0 R1 R2"
);
pw
.
println
(
"ADD R2 R0 R1"
);
pw
.
println
(
"RET R2"
);
pw
.
println
(
"RET R2"
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
...
This diff is collapsed.
Click to expand it.
src/machine-vuln1.c
+
6
−
2
View file @
8be782ee
...
@@ -55,7 +55,8 @@ unsigned int count = 0; /* counts number of instructions executed so far */
...
@@ -55,7 +55,8 @@ unsigned int count = 0; /* counts number of instructions executed so far */
static
void
machine_init
(
void
){
static
void
machine_init
(
void
){
memory
=
malloc
(
sizeof
(
int32_t
)
*
MEMORY_SIZE
);
/*Change doesn't clean all of memory, doing a read on the last memory loc vuln*/
memory
=
malloc
(
sizeof
(
int32_t
)
*
(
MEMORY_SIZE
-
1
));
regs
=
malloc
(
sizeof
(
int32_t
)
*
NUM_REGS
);
regs
=
malloc
(
sizeof
(
int32_t
)
*
NUM_REGS
);
/* memset can be vulnerable - changes to this can result in dirty memory to be read*/
/* memset can be vulnerable - changes to this can result in dirty memory to be read*/
...
@@ -86,12 +87,15 @@ static void do_mult(unsigned int dest, unsigned int src1, unsigned int src2)
...
@@ -86,12 +87,15 @@ static void do_mult(unsigned int dest, unsigned int src1, unsigned int src2)
}
}
/* returns 0 on success, nonzero on failure */
/* returns 0 on success, nonzero on failure */
/*CHANGE - Divide by Zero now possible*/
static
int
do_div
(
unsigned
int
dest
,
unsigned
int
src1
,
unsigned
int
src2
)
static
int
do_div
(
unsigned
int
dest
,
unsigned
int
src1
,
unsigned
int
src2
)
{
{
if
(
regs
[
src2
]
==
0
){
return
-
1
;
}
else
{
regs
[
dest
]
=
regs
[
src1
]
/
regs
[
src2
];
regs
[
dest
]
=
regs
[
src1
]
/
regs
[
src2
];
return
0
;
return
0
;
}
}
}
/* returns 0 on success, nonzero on failure */
/* returns 0 on success, nonzero on failure */
static
int
do_load
(
unsigned
int
dest
,
unsigned
int
src
,
int32_t
offs
){
static
int
do_load
(
unsigned
int
dest
,
unsigned
int
src
,
int32_t
offs
){
...
...
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