Exploit database

GH-de2318f62d43bced52bf249576e6dec9

hoangrealer/cve-2023-27216

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2023-27216

1 source

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files11

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

_DSL-3782_A1_EU_1.01_07282016.bin.extracted/squashfs-root/boaroot/html/js/New_GUI/Advanced/Applications.js

JavaScript · 10,881 bytes
var maxRule = 16;
var statusAction=new Array("","<font color=blue>"+m_comm_Active+"</font>","<font color=red>"+m_comm_Inactive+"</font>");
var ApplictionCount = 0;
var ApplictionList = new Array();

CountApplication();
function CountApplication() {
	for(var i = 0; i < maxRule; i++) {
		var port_name = eval("port"+i+"_name");
		if(port_name != "N/A" && port_name != "&#45;" && port_name != "-") {
			var port_active = eval("port"+i+"_active");
			var port_tsport = eval("port"+i+"_tsport");
			var port_teport = eval("port"+i+"_teport");
			var port_tprotocol = eval("port"+i+"_tprotocol");
			var port_oport = eval("port"+i+"_oport");
			var port_oprotocol = eval("port"+i+"_oprotocol");
			ApplictionList.push([port_name,port_active,port_tsport,port_teport,port_tprotocol,port_oport,port_oprotocol]);
			ApplictionCount ++;
		} else {
			ApplictionList.push(["","","","","","",""]);
		}
	}
}

function uiDoOnLoad() {
	if(parseInt(ApplictionCount) < parseInt(maxRule)){
		document.getElementById("createButton").setAttribute("class", "styled_button_s");
		document.getElementById("createButton").disabled = false;
	}
	else{
		document.getElementById("createButton").setAttribute("class", "styled_button_dis");
		document.getElementById("createButton").disabled = true;
	}

	$("select").selectbox();
}

function enable_control() {	
	if($("#app_enable_ck").attr("checked")) {
		$("input[type='text']").removeAttr("disabled");
		$("#trigger_type").selectbox("enable");
		$("#public_type").selectbox("enable");	
	} 
	else {
		$("input[type='text']").attr("disabled", "disabled");
		$("#trigger_type").selectbox("disable");
		$("#public_type").selectbox("disable");
	}
}

function findprotocol(valueselect) {
	switch(valueselect) {
		case "TCP/UDP":
			return "All Protocol";
			break;
		case "TCP":
			return "TCP";
			break;
		case "UDP":
			return "UDP";
			break;
		default:
			return "All Protocol";
			break;
	}
}

function gen_table() {
	var str="";
	if(ApplictionCount > 0) {
		for(var i = 0; i < ApplictionList.length; i++) {
			if(ApplictionList[i][0] != "") {
				str+="<tr>";
				str+="<td>" +statusAction[(ApplictionList[i][1]=="Yes"? 1:2)] +"</td>";
				str+="<td>" +ApplictionList[i][0] +"</td>";
				str+="<td>" +ApplictionList[i][2]+'~'+ApplictionList[i][3]+"</td>";
				str+="<td>" +findprotocol(ApplictionList[i][4])+"</td>";
				str+="<td>" +ApplictionList[i][5] +"</td>";
				str+="<td>" +findprotocol(ApplictionList[i][6]) +"</td>";
				str+='<td><img src="/graphic/New_GUI/edit_btn.gif" width=28 height=28 style="cursor:pointer" onclick="EditRow('+i+')"/></td>';
				str+='<td>';
				str+='<img src="/graphic/New_GUI/trash.gif" width=41 height=41 style="cursor:pointer" onclick="deleteDate('+i+')"/>';
				str+='<input type="hidden" id="enable_'+i+'" name="enable_'+i+'"  value="0">';
				str+='</td>';
				str+="</tr>";
			}
		}		
	}
	document.write(str);
}

function deleteDate(i){
	var f = document.getElementById("frm");
	var st = eval("f.enable_"+i);	
	st.value = 1;
	
	if(confirm(m_comm_deldesc)) {
		
		$("#buttonType").val("delete");		

		document.getElementById("CreatePopAlertMessage").style.display = "inline";
		document.getElementById("waitSettingFinish").style.display = "inline";
		Start_reciprocal_Number_RestoreConfiguration();
		
		$.get("/cgi-bin/get/New_GUI/get_sessionKey.asp", function(sessionKey){
			$("#sessionKey").val(sessionKey);	
			setTimeout('$.post("/cgi-bin/New_GUI/Application.asp", $("form").serialize(), function(){save_flag = true;});', 300);
		});
	}
}

function EditRow(r) {
	createEditButton();
	
	$("#editRow").val(r);

	var port_name = eval("port"+r+"_name");
	var port_active = eval("port"+r+"_active");
	var port_tsport = eval("port"+r+"_tsport");
	var port_teport = eval("port"+r+"_teport");
	var port_tprotocol = eval("port"+r+"_tprotocol");
	var port_oport = eval("port"+r+"_oport");
	var port_oprotocol = eval("port"+r+"_oprotocol");

	if( port_active == "Yes" )
		SetCheckBoxEnable("app_enable", true, true);
	else
		SetCheckBoxEnable("app_enable", true, false);
	hideSaveBtn();

	$("#app_name").val(decodeSpecialChr(port_name));
	$("#triger_port_start").val(port_tsport);
	$("#triger_port_end").val(port_teport);
	
	$("#trigger_type").val(port_tprotocol);
	$("#trigger_type").selectbox('change', $("#trigger_type").val(), $("#trigger_type").find('option:selected').text());
	
	$("#public_port").val(decodeSpecialChr(port_oport));	
	
	$("#public_type").val(port_oprotocol);
	$("#public_type").selectbox('change', $("#public_type").val(), $("#public_type").find('option:selected').text());
	
	enable_control();
}

function Prefixes_Rule(TelNum)
{
	for (var i=0; i<TelNum.length; i++) {
		if(TelNum.charAt(i)=='#') return false;
		if(TelNum.charAt(i)=='&') return false;
	}
	return true;
}

function isUnsafeChar(cmpStr)
{
	var regStr=/[a-zA-Z0-9]/;
  	for(i=0;i<cmpStr.length;i++)
  	{ 
  		if(cmpStr.charAt(i) == '-')
			continue;
		if (cmpStr.charAt(i).search(regStr)==-1) //contain the unsafe char
			return false;
	}
	return true;	
}

function uiDoValidate() {
	var tmp=new Array();
	var tmp1=new Array();
	var tmp2=new Array();
	var i,j,k;
	if($("#app_enable_ck").attr("checked")) {
		if (($("#app_name").val().length==0)||($("#app_name").val().length>32)) 
		{
			$("#app_name_error").html("<br/>"+m_application_err_1);
			return false;
		}
		
		if (!isNumber($("#triger_port_start").val())||(parseInt($("#triger_port_start").val())<=0)||parseInt($("#triger_port_start").val())>65535) {
			$("#triger_port_start_error").html("<br/>"+m_application_err_2);			
			return false;
		}

		if (!isNumber($("#triger_port_end").val())||(parseInt($("#triger_port_end").val())<=0)||parseInt($("#triger_port_end").val())>65535) {
			$("#triger_port_end_error").html("<br/>"+m_application_err_2);
			return false;
		}
		
		if(parseInt($("#triger_port_start").val())>parseInt($("#triger_port_end").val())) {
			$("#triger_port_end_error").html("<br/>"+m_application_err_2);			
			return false;
		}
		
		var m=$("#public_port").val();
		if(m!="") {
	 		if(m.search(",") == -1)
				tmp[0] = m;
			else
				tmp = m.split(",");
			for(i=0,j=0;i<tmp.length;i++) {
				if(tmp[i].search("-") == -1) {
					tmp2[j] = tmp[i];
					j++;
				} else {	
					tmp1 = tmp[i].split("-");
					if(tmp1[0]>=tmp1[1]) {
						$("#public_port_error").html("<br/>"+m_application_err_3);
						return false;
					}
					tmp2[j]=tmp1[0];
					tmp2[j+1]=tmp1[1];
					j=j+2;
				}
			}
		}
		for(k=0;k<tmp2.length;k++) {
			if (!isNumber(tmp2[k])||(parseInt(tmp2[k])<=0)||parseInt(tmp2[k])>65535) {
				$("#public_port_error").html("<br/>"+m_application_err_4);
				return false;
		 	}
		}
	}
	
	var entry;
	if($("#editRow").val()=="-1") {
		for(var i = 0; i < ApplictionList.length; i++) {
			if(ApplictionList[i][0] == "") {
				entry = i;
				break;
			}
		}
	} 
	else 
	{
		entry = $("#editRow").val();
	}

	var z=0,m=0;p=0;
	for (var i=0; i<ApplictionList.length; i++) {
		if(entry == i)
			continue;
		if($("#app_name").val()==ApplictionList[i][0])
			z++;
		if($("#triger_port_start").val()==ApplictionList[i][2]&&$("#triger_port_end").val()==ApplictionList[i][3])
			m++;
		 if($("#public_port").val()==ApplictionList[i][5])
		 	p++;		
	}
	if(z != 0) {
		$("#app_name_error").html("<br/>"+m_application_err_5);
		return false;
	}
	
	if(m != 0) {
		$("#triger_port_start_error").html("<br/>"+m_application_err_6);		
		return false;
	}
	
	if(p!= 0) {
		$("#public_port_error").html("<br/>"+m_application_err_7);		
		return false;
	}

	return true;
}

function uiDoSave() {
	$("label[class='error']").html("");
	
	if (uiDoValidate()==false) return;

	if($("#editRow").val() == "-1") {		
		for(var i = 0; i < ApplictionList.length; i++) {
			if(ApplictionList[i][0] == "") {
				$("#editRow").val(i)
				break;
			}				
		}
	}

	if($("#app_enable_ck").attr("checked")) 
		$("#app_enables").val("Yes");
	else
		$("#app_enables").val("No");

	$("#buttonType").val("apply")

	document.getElementById("CreatePopAlertMessage").style.display = "inline";
	document.getElementById("waitSettingFinish").style.display = "inline";
	Start_reciprocal_Number_RestoreConfiguration();
	
	$.get("/cgi-bin/get/New_GUI/get_sessionKey.asp", function(sessionKey){
		$("#sessionKey").val(sessionKey);	
		setTimeout('$.post("/cgi-bin/New_GUI/Application.asp", $("form").serialize(), function(){save_flag = true;});', 300);
	});
}

function changeApplication(){
	SetCheckBoxEnable("app_enable");
	hideSaveBtn();
}

function createEditButton()
{
	$("#popTitle").html();
	document.getElementById("createPop").style.display = "inline";
	document.getElementById("createButton").disabled = true;
	$("#frm").val(-1);
}

function createUserButton()
{
	$("#popTitle").html(m_comm_createnew);
	document.getElementById("createPop").style.display = "inline";
	document.getElementById("createButton").disabled = true;
	$("#frm").val(-1);

	initPop();	
}

function initPop(){	
	$("input[type='text']").val('');
	$("#trigger_type").val('0');
	$("#public_type").val('0');
	$("#editRow").val('-1');
	SetCheckBoxEnable("app_enable", true, true);
	enable_control();
	hideSaveBtn();
}

function resetRulePOP()
{	
	document.getElementById("createPop").style.display = "none";
}

function check_TotalRule(maxRule, totalRule)
{
	var IsFull = maxRule - totalRule;
	document.getElementById("RemainingRules").innerHTML = IsFull;
	
	if (IsFull == 0)
	{
		document.getElementById("createButton").setAttribute("class", "styled_button_dis");
		document.getElementById("createButton").disabled = true;
	}
	else
	{
		document.getElementById("createButton").setAttribute("class", "styled_button_s");
		document.getElementById("createButton").disabled = false;
	}
}

function clearCreateRulePOP()
{
	resetRulePOP();	
	$("input[type='text']").val("");
	$("select option:first").attr("selected", true);
	$("label[class='error']").html("");
	$(':text').prop('className', 'styled-text');
	check_TotalRule(maxRule, ApplictionCount);
}

var save_flag = false;
var _ReciprocalNumber = 10;
function Start_reciprocal_Number_RestoreConfiguration() {
	if (_ReciprocalNumber >= 0) {
		document.getElementById("reciprocal_Number").innerHTML = _ReciprocalNumber + m_comm_Sec;
		_ReciprocalNumber --;
		setTimeout("Start_reciprocal_Number_RestoreConfiguration()", 1000);
	} else {
		if(save_flag) {
			document.getElementById("waitSettingFinish").style.display = "none";
			document.getElementById("SuccessSettings").style.display = "inline";
		} else {
			setTimeout("Start_reciprocal_Number_RestoreConfiguration()", 1000);
		}
	}
}