The apcupsd module, drilled into UPS stats results in webmin thinking we're doing an XSS attack(?)
I have a UPS monitored by apcupsd, and webmin by default ships with the module for it (iirc).
See attachment for "default view" of the module.
OK so if you click on "Local Host" (under the system column), it shows the user some more details about the UPS with some fancy diagrams and other functionality;
the URL path it brings us to:
https://192.168.0.3:10000/apcupsd/upsstats_wrapper.cgi?host=127.0.0.1&temp=C
hmmm, herein lies the problem ^^^; we can see that the host param is set to 127.0.0.1 (localhost), which could be fine... EXCEPT within a few seconds webmin complains:
Security Warning
Warning! Webmin has detected that the program https://192.168.0.3:10000/apcupsd/upsstats_wrapper.cgi?host=127.0.0.1&temp=C was linked to from an unknown URL, which appears to be outside the Webmin server. This may be an attempt to trick your server into executing a dangerous command.
Make sure your browser is configured to send referrer information so that it can be verified by Webmin.
Alternately, you can configure Webmin to allow links from unknown referers by :
Login as root, and edit the /etc/webmin/config file.
Find the line referers_none=1 and change it to referers_none=0.
Save the file.
WARNING - this has the side effect of opening your system up to reflected XSS attacks and so is not recommended!!
I don't think this is the right default behaviour. We definitely don't really want to have these defaults which MAY result in users opening up their system to reflected XSS attacks.
Few extra debug/notes
not sure why this is empty
The apcupsd configuration file of note, (on my system) has its
NISIPvalue set like this:I have two systems, this appears to be the default on both my Debian and CentOS based systems.
Also I doubt the RCA would be the raw daemon's config anyway.
Here's the
apcupsdconfigWithin the actual cgi script
This leads me to believe we're into the "update/refresh" logic of the code. As the page initially loads fine, but then shortly thereafter (i.e. the
update_intervalattempts to refresh the sub-page in the module then fails).From the wrapper CGI code, I can't really see where/how the
metasget suffixed by?host=127.0.0.1&temp=C...Last edit: Fermulator 2019-03-04
as a "PS/confused" note .. I'm confused where this module even comes from (where does the source code live?)
I can't find it in the github repo:
(even pulled it down and tried searching ... empty results
nor does it seem to qualify as a "3rd party module"
http://www.webmin.com/cgi-bin/search_third.cgi?search=apcups
hmmm
Hi,
This module is outdated. Besides, this module is not in the default list, and not distributed with Webmin package.
The problem is becase the page is being refreshed/redirected incorrectly. There should be module configuration and you can disable automatic refresh.
You can write JavaScript extension for Webmin/Authentic Theme to make it automatically refresh the page every needed amount of seconds.
I also discovered that author can be contacted via support at bks.da.ru.
Last edit: Ilia 2019-03-04
Hi thanks for the reply.
How/where did you find reference to this module btw? (please provide a link if you are able)
I am curious also how this module showed up in my webmin installation. I did not manually add any 3rd party modules myself. Perhaps it gets installed automatically by the apcupsd package manager on Linux? (it appears on both dnf and apt systems the same)
Have sent a support request to the above-noted e-mail to author for attention.