Files
webmin/qmailadmin/detach_queue.cgi
Ilia Ross ae8feb1854
Some checks failed
Tests / prove (push) Has been cancelled
Package and upload artifacts / build (push) Has been cancelled
Fix remaining mail queue attachment XSS
Follow up to: https://github.com/webmin/webmin/commit/dda9b97
2026-10-16 01:46:06 +02:00

23 lines
533 B
Perl
Executable File

#!/usr/local/bin/perl
# detach_queue.cgi
# View one attachment from a queued message
require './qmail-lib.pl';
&ReadParse();
$mail = &read_mail_file($in{'file'});
&parse_mail($mail);
$attach = $mail->{'attach'}->[$in{'attach'}];
print "X-no-links: 1\n";
if ($attach->{'type'} =~ /^text\/html/i ||
$attach->{'type'} =~ /^image\/svg(?:\+xml)?/i ||
$attach->{'type'} =~ /^application\/xhtml\+xml/i) {
print "Content-type: text/plain\n\n";
}
else {
print "Content-type: $attach->{'type'}\n\n";
}
print $attach->{'data'};