I was just taking a look at this file at my openwrt system(OpenWrt 17.01, Lua version 5.1.5).
At the file, i can see following scripts
~~~
local timeout = uci_cursor:get("dynapoint", "internet", "timeout")
~~~
function do_internet_check(host)
if (curl == 1 ) then
if (curl_interface) then
result = os.execute("curl -s -m "..timeout.." --max-redirs 0 --interface "..curl_interface.." --head "..host.." > /dev/null")
else
result = os.execute("curl -s -m "..timeout.." --max-redirs 0 --head "..host.." > /dev/null")
end
else
result = os.execute("wget -q --timeout="..timeout.." --spider "..host)
end
if (result == 0) then
return true
else
return false
end
end
If, that do_internet_check(host)
function is used somewhere,
i think someone can use command injection attack.
like setting that timeout
value manually, such as ; reboot
,
Then, when
result = os.execute("curl -s -m "..timeout.." --max-redirs 0 --interface "..curl_interface.." --head "..host.." > /dev/null")
script is executed, it's gonna reboot the system.
Am i right?