Skip to content

Commit

Permalink
Escape parameters in various error output
Browse files Browse the repository at this point in the history
When unknown actions are unknown, the error message output include unescaped
values leading to XSS

Fixes #1477
Fixes #1479
Fixes #1480
  • Loading branch information
reedy committed Aug 20, 2024
1 parent 760f514 commit 36733f4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion php/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
break;

default:
die("0;" . sprintf(_("Unknown action %s"), $type));
die("0;" . sprintf(_("Unknown action %s"), htmlspecialchars($type)));
}

// Note: Password is actually an MD5 hash of pw and username
Expand Down
2 changes: 1 addition & 1 deletion php/submit.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
break;

default:
die('0;Unknown operation ' . $param);
die('0;Unknown operation ' . htmlspecialchars($param));
}

print "$code;$msg";
2 changes: 1 addition & 1 deletion php/trip.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function failIfFalse($res, $name) {
break;

default:
die('0;Unknown operation ' . $type);
die('0;Unknown operation ' . htmlspecialchars($type));
}

failIfFalse($success, $name);
Expand Down

0 comments on commit 36733f4

Please sign in to comment.