[*] Binary protection state of customhttpheader.cgi
Full RELRO Canary found NX disabled PIE enabled No RPATH No RUNPATH No Symbols
[*] Function printf tear down of customhttpheader.cgi
; assembly | /* r2dec pseudo code output */
| /* /logs/firmware/unblob_extracted/firmware_extract/4325012-58052244.squashfs_v4_le_extract/usr/html/axis-cgi/customhttpheader.cgi @ 0x1d9c */
| #include <stdint.h>
|
; (fcn) sym.set_custom_header () | void set_custom_header () {
0x00001d9c lui gp, 2 |
0x00001da0 addiu gp, gp, -0x5d4c |
0x00001da4 addu gp, gp, t9 | gp += t9;
0x00001da8 lw v0, -0x7f24(gp) | v0 = *((gp - 8137));
0x00001dac addiu sp, sp, -0x78 |
0x00001db0 lw v1, -0x7fdc(gp) | v1 = *((gp - 8183));
0x00001db4 lw t9, -0x7fdc(gp) | t9 = *((gp - 8183));
0x00001db8 sw v0, 0x38(sp) | *(var_38h) = v0;
0x00001dbc lw v0, (v0) | v0 = *(v0);
0x00001dc0 sw gp, 0x18(sp) | *(var_18h) = gp;
0x00001dc4 sw s7, 0x6c(sp) | *(var_6ch) = s7;
0x00001dc8 sw s1, 0x54(sp) | *(var_54h) = s1;
0x00001dcc sw ra, 0x74(sp) | *(var_74h) = ra;
0x00001dd0 sw fp, 0x70(sp) | *(var_70h) = fp;
0x00001dd4 sw s6, 0x68(sp) | *(var_68h) = s6;
0x00001dd8 sw s5, 0x64(sp) | *(var_64h) = s5;
0x00001ddc sw s4, 0x60(sp) | *(var_60h) = s4;
0x00001de0 sw s3, 0x5c(sp) | *(var_5ch) = s3;
0x00001de4 sw s2, 0x58(sp) | *(var_58h) = s2;
0x00001de8 sw s0, 0x50(sp) | *(var_50h) = s0;
0x00001dec sw v1, 0x3c(sp) | *(var_3ch) = v1;
0x00001df0 move s7, a0 | s7 = a0;
0x00001df4 sw a1, 0x2c(sp) | *(var_2ch) = a1;
0x00001df8 addiu a0, v1, 0x33b8 | a0 = v1 + str._etc_httpconf_customheader.conf;
0x00001dfc sw v0, 0x4c(sp) | *(var_4ch) = v0;
0x00001e00 sw zero, 0x44(sp) | *(var_44h) = 0;
0x00001e04 sw zero, 0x48(sp) | *(var_48h) = 0;
0x00001e08 addiu t9, t9, 0x1c70 | t9 += fcn.00001c70;
0x00001e0c bal 0x1c70 | fcn_00001c70 ();
0x00001e10 nop |
0x00001e14 move s1, v0 | s1 = v0;
0x00001e18 lw gp, 0x18(sp) | gp = *(var_18h);
| if (v0 == 0) {
0x00001e1c beqz v0, 0x2190 | goto label_6;
| }
0x00001e20 lw v0, -0x7fdc(gp) | v0 = *((gp - 8183));
0x00001e24 lw t9, -0x7edc(gp) | t9 = sym.imp.g_key_file_has_group;
0x00001e28 sw v0, 0x34(sp) | *(var_34h_2) = v0;
0x00001e2c addiu a1, v0, 0x33d8 | a1 = v0 + str.customheaders;
0x00001e30 move a0, s1 | a0 = s1;
0x00001e34 jalr t9 | t9 ();
0x00001e38 lw gp, 0x18(sp) | gp = *(var_18h);
| if (v0 != 0) {
0x00001e3c bnez v0, 0x2124 | goto label_7;
| }
0x00001e40 sw zero, 0x44(sp) | *(var_44h) = 0;
0x00001e44 addiu a0, zero, 8 | a0 = 8;
0x00001e48 sw zero, 0x28(sp) | *(var_28h) = 0;
| label_2:
0x00001e4c lw t9, -0x7f50(gp) | t9 = sym.imp.g_malloc0;
0x00001e50 jalr t9 | t9 ();
0x00001e54 nop |
0x00001e58 sw v0, 0x24(sp) | *(var_24h) = v0;
0x00001e5c lw gp, 0x18(sp) | gp = *(var_18h);
| if (v0 == 0) {
0x00001e60 beqz v0, 0x2188 | goto label_8;
| }
0x00001e64 lw v0, 0x34(sp) | v0 = *(var_34h_2);
0x00001e68 lw s0, 0x24(sp) | s0 = *(var_24h);
0x00001e6c addiu s6, v0, 0x33d8 | s6 = v0 + str.customheaders;
0x00001e70 lw v0, -0x7fdc(gp) | v0 = *((gp - 8183));
0x00001e74 move s4, s0 | s4 = s0;
0x00001e78 addiu v0, v0, 0x33e8 | v0 += 0x33e8;
0x00001e7c lw s3, 0x28(sp) | s3 = *(var_28h);
0x00001e80 move s2, zero | s2 = 0;
0x00001e84 sw zero, 0x30(sp) | *(var_30h) = 0;
0x00001e88 addiu s5, sp, 0x48 | s5 = sp + 0x48;
0x00001e8c sw v0, 0x20(sp) | *(var_20h) = v0;
0x00001e90 b 0x1eb8 |
| while (v0 != 0) {
| label_0:
0x00001e94 lw t9, -0x7f74(gp) | t9 = sym.imp.g_strfreev;
0x00001e98 move a0, fp | a0 = fp;
0x00001e9c jalr t9 | t9 ();
0x00001ea0 addiu s2, s2, 1 | s2++;
0x00001ea4 addiu v0, zero, 0xa | v0 = 0xa;
0x00001ea8 lw gp, 0x18(sp) | gp = *(var_18h);
0x00001eac addiu s0, s0, 4 | s0 += 4;
0x00001eb0 addiu s3, s3, 4 | s3 += 4;
| if (s2 == v0) {
0x00001eb4 beq s2, v0, 0x1f80 | goto label_9;
| }
0x00001eb8 lw v0, 0x44(sp) | v0 = *(var_44h);
0x00001ebc slt v1, s2, v0 | v1 = (s2 < v0) ? 1 : 0;
0x00001ec0 lw t9, -0x7ec0(gp) | t9 = sym.imp.g_key_file_get_string;
| if (v1 == 0) {
0x00001ec4 beqz v1, 0x1f84 | goto label_10;
| }
0x00001ec8 lw a2, (s3) | a2 = *(s3);
0x00001ecc move a3, s5 | a3 = s5;
0x00001ed0 move a1, s6 | a1 = s6;
0x00001ed4 move a0, s1 | a0 = s1;
0x00001ed8 jalr t9 | t9 ();
0x00001edc lw v1, 0x48(sp) | v1 = *(var_48h);
0x00001ee0 lw gp, 0x18(sp) | gp = *(var_18h);
0x00001ee4 sw v0, (s0) | *(s0) = v0;
| if (v1 != 0) {
0x00001ee8 bnez v1, 0x2154 | goto label_11;
| }
0x00001eec lw t9, -0x7ed0(gp) | t9 = sym.imp.g_key_file_remove_key;
0x00001ef0 lw a2, (s3) | a2 = *(s3);
0x00001ef4 move a3, s5 | a3 = s5;
0x00001ef8 move a1, s6 | a1 = s6;
0x00001efc move a0, s1 | a0 = s1;
0x00001f00 jalr t9 | t9 ();
0x00001f04 lw v1, 0x48(sp) | v1 = *(var_48h);
0x00001f08 lw gp, 0x18(sp) | gp = *(var_18h);
| if (v1 != 0) {
0x00001f0c bnez v1, 0x2154 | goto label_11;
| }
0x00001f10 lw t9, -0x7f48(gp) | t9 = sym.imp.g_strsplit;
0x00001f14 lw a0, (s0) | a0 = *(s0);
0x00001f18 lw a1, 0x20(sp) | a1 = *(var_20h);
0x00001f1c addiu a2, zero, 2 | a2 = 2;
0x00001f20 jalr t9 | t9 ();
0x00001f24 lw gp, 0x18(sp) | gp = *(var_18h);
0x00001f28 lw a1, (v0) | a1 = *(v0);
0x00001f2c move a0, s7 | a0 = s7;
0x00001f30 lw t9, -0x7f8c(gp) | t9 = sym.imp.g_ascii_strcasecmp;
0x00001f34 move fp, v0 | fp = v0;
0x00001f38 jalr t9 | t9 ();
0x00001f3c lw gp, 0x18(sp) | gp = *(var_18h);
0x00001f40 bnez v0, 0x1e94 |
| }
0x00001f44 lw t9, -0x7eac(gp) | t9 = sym.imp.g_free;
0x00001f48 addiu v0, zero, 1 | v0 = 1;
0x00001f4c lw a0, (s0) | a0 = *(s0);
0x00001f50 sw v0, 0x30(sp) | *(var_30h) = v0;
0x00001f54 jalr t9 | t9 ();
0x00001f58 lw gp, 0x18(sp) | gp = *(var_18h);
0x00001f5c lw a2, 0x2c(sp) | a2 = *(var_2ch);
0x00001f60 lw a1, 0x20(sp) | a1 = *(var_20h);
0x00001f64 lw t9, -0x7ed4(gp) | t9 = sym.imp.g_strconcat;
0x00001f68 move a3, zero | a3 = 0;
0x00001f6c move a0, s7 | a0 = s7;
0x00001f70 jalr t9 | t9 ();
0x00001f74 lw gp, 0x18(sp) | gp = *(var_18h);
0x00001f78 sw v0, (s0) | *(s0) = v0;
0x00001f7c b 0x1e94 | goto label_0;
| label_9:
0x00001f80 lw v0, 0x44(sp) | v0 = *(var_44h);
| label_10:
0x00001f84 lw v1, 0x30(sp) | v1 = *(var_30h);
0x00001f88 lw a1, -0x7fdc(gp) | a1 = *((gp - 8183));
| if (v1 == 0) {
0x00001f8c beqz v1, 0x21a0 | goto label_12;
| }
| label_4:
0x00001f90 lw v0, 0x34(sp) | v0 = *(var_34h_2);
| if (v0 <= 0) {
0x00001f94 blez v0, 0x2000 | goto label_13;
| }
0x00001f98 lw s0, -0x7fdc(gp) | s0 = *((gp - 8183));
0x00001f9c move s3, zero | s3 = 0;
0x00001fa0 addiu s0, s0, 0x33ec | s0 += 0x33ec;
0x00001fa4 addiu s2, v0, 0x33d8 | s2 = v0 + str.customheaders;
| do {
0x00001fa8 lw t9, -0x7ef4(gp) | t9 = sym.imp.g_strdup_printf
0x00001fac move a1, s3 | a1 = s3;
0x00001fb0 move a0, s0 | a0 = s0;
0x00001fb4 jalr t9 | t9 ();
0x00001fb8 lw gp, 0x18(sp) | gp = *(var_18h);
0x00001fbc lw a3, (s4) | a3 = *(s4);
0x00001fc0 move a2, v0 | a2 = v0;
0x00001fc4 lw t9, -0x7ecc(gp) | t9 = sym.imp.g_key_file_set_string;
0x00001fc8 move a1, s2 | a1 = s2;
0x00001fcc move a0, s1 | a0 = s1;
0x00001fd0 move s6, v0 | s6 = v0;
0x00001fd4 jalr t9 | t9 ();
0x00001fd8 lw gp, 0x18(sp) | gp = *(var_18h);
0x00001fdc move a0, s6 | a0 = s6;
0x00001fe0 addiu s3, s3, 1 | s3++;
0x00001fe4 lw t9, -0x7eac(gp) | t9 = sym.imp.g_free;
0x00001fe8 addiu s4, s4, 4 | s4 += 4;
0x00001fec jalr t9 | t9 ();
0x00001ff0 lw v0, 0x44(sp) | v0 = *(var_44h);
0x00001ff4 slt v0, s3, v0 | v0 = (s3 < v0) ? 1 : 0;
0x00001ff8 lw gp, 0x18(sp) | gp = *(var_18h);
0x00001ffc bnez v0, 0x1fa8 |
| } while (v0 != 0);
| label_13:
0x00002000 lw v0, 0x3c(sp) | v0 = *(var_3ch);
0x00002004 lw t9, -0x7f84(gp) | t9 = sym.imp.g_key_file_save_to_file;
0x00002008 move a2, s5 | a2 = s5;
0x0000200c addiu a1, v0, 0x33b8 | a1 = v0 + str._etc_httpconf_customheader.conf;
0x00002010 move a0, s1 | a0 = s1;
0x00002014 jalr t9 | t9 ();
0x00002018 lw gp, 0x18(sp) | gp = *(var_18h);
| if (v0 == 0) {
0x0000201c beqz v0, 0x2188 | goto label_8;
| }
0x00002020 lw t9, -0x7f1c(gp) | t9 = sym.imp.json_object;
0x00002024 jalr t9 | t9 ();
0x00002028 nop |
0x0000202c lw gp, 0x18(sp) | gp = *(var_18h);
0x00002030 lw a0, 0x2c(sp) | a0 = *(var_2ch);
0x00002034 lw t9, -0x7efc(gp) | t9 = sym.imp.json_string;
0x00002038 move s0, v0 | s0 = v0;
0x0000203c jalr t9 | t9 ();
0x00002040 lw gp, 0x18(sp) | gp = *(var_18h);
0x00002044 move a2, v0 | a2 = v0;
0x00002048 move a1, s7 | a1 = s7;
0x0000204c lw t9, -0x7f54(gp) | t9 = sym.imp.json_object_set_new;
0x00002050 move a0, s0 | a0 = s0;
0x00002054 jalr t9 | t9 ();
0x00002058 lw gp, 0x18(sp) | gp = *(var_18h);
| label_3:
0x0000205c lw v1, 0x48(sp) | v1 = *(var_48h);
0x00002060 lw t9, -0x7f6c(gp) | t9 = sym.imp.g_key_file_free;
| if (v1 == 0) {
0x00002064 beqz v1, 0x20b4 | goto label_14;
| }
0x00002068 lw v0, 8(v1) | v0 = *((v1 + 2));
0x0000206c lw v1, 4(v1) | v1 = *((v1 + 1));
| if (v0 == 0) {
0x00002070 beqz v0, 0x2164 | goto label_15;
| }
| do {
| label_1:
0x00002074 lw a3, -0x7fdc(gp) | a3 = *((gp - 8183));
0x00002078 lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x0000207c lw t9, -0x7f28(gp) | t9 = sym.imp.__syslog_chk;
0x00002080 addiu a3, a3, 0x3400 | a3 += str.set_custom_header;
0x00002084 addiu a2, a2, 0x33a4 | a2 += str._s:_error:__d__s;
0x00002088 addiu a1, zero, 1 | a1 = 1;
0x0000208c addiu a0, zero, 3 | a0 = 3;
0x00002090 sw v0, 0x14(sp) | *(var_14h) = v0;
0x00002094 sw v1, 0x10(sp) | *(var_10h) = v1;
0x00002098 jalr t9 | t9 ();
0x0000209c lw gp, 0x18(sp) | gp = *(var_18h);
0x000020a0 lw t9, -0x7f70(gp) | t9 = sym.imp.g_error_free;
0x000020a4 lw a0, 0x48(sp) | a0 = *(var_48h);
0x000020a8 jalr t9 | t9 ();
0x000020ac lw gp, 0x18(sp) | gp = *(var_18h);
| label_5:
0x000020b0 lw t9, -0x7f6c(gp) | t9 = sym.imp.g_key_file_free;
| label_14:
0x000020b4 move a0, s1 | a0 = s1;
0x000020b8 jalr t9 | t9 ();
0x000020bc lw gp, 0x18(sp) | gp = *(var_18h);
0x000020c0 lw t9, -0x7f74(gp) | t9 = sym.imp.g_strfreev;
0x000020c4 lw a0, 0x28(sp) | a0 = *(var_28h);
0x000020c8 jalr t9 | t9 ();
0x000020cc lw gp, 0x18(sp) | gp = *(var_18h);
0x000020d0 lw t9, -0x7f74(gp) | t9 = sym.imp.g_strfreev;
0x000020d4 lw a0, 0x24(sp) | a0 = *(var_24h);
0x000020d8 jalr t9 | t9 ();
0x000020dc lw v0, 0x38(sp) | v0 = *(var_38h);
0x000020e0 lw a0, 0x4c(sp) | a0 = *(var_4ch);
0x000020e4 lw gp, 0x18(sp) | gp = *(var_18h);
0x000020e8 lw v1, (v0) | v1 = *(v0);
0x000020ec move v0, s0 | v0 = s0;
| if (a0 != v1) {
0x000020f0 bne a0, v1, 0x21e8 | goto label_16;
| }
0x000020f4 lw ra, 0x74(sp) | ra = *(var_74h);
0x000020f8 lw fp, 0x70(sp) | fp = *(var_70h);
0x000020fc lw s7, 0x6c(sp) | s7 = *(var_6ch);
0x00002100 lw s6, 0x68(sp) | s6 = *(var_68h);
0x00002104 lw s5, 0x64(sp) | s5 = *(var_64h);
0x00002108 lw s4, 0x60(sp) | s4 = *(var_60h);
0x0000210c lw s3, 0x5c(sp) | s3 = *(var_5ch);
0x00002110 lw s2, 0x58(sp) | s2 = *(var_58h);
0x00002114 lw s1, 0x54(sp) | s1 = *(var_54h);
0x00002118 lw s0, 0x50(sp) | s0 = *(var_50h);
0x0000211c addiu sp, sp, 0x78 |
0x00002120 jr ra | return v0;
| label_7:
0x00002124 lw v0, 0x34(sp) | v0 = *(var_34h_2);
0x00002128 lw t9, -0x7eb4(gp) | t9 = sym.imp.g_key_file_get_keys;
0x0000212c addiu a3, sp, 0x48 | a3 = sp + 0x48;
0x00002130 addiu a2, sp, 0x44 | a2 = sp + 0x44;
0x00002134 addiu a1, v0, 0x33d8 | a1 = v0 + str.customheaders;
0x00002138 move a0, s1 | a0 = s1;
0x0000213c jalr t9 | t9 ();
0x00002140 lw v1, 0x48(sp) | v1 = *(var_48h);
0x00002144 lw gp, 0x18(sp) | gp = *(var_18h);
0x00002148 sw v0, 0x28(sp) | *(var_28h) = v0;
| if (v1 == 0) {
0x0000214c beqz v1, 0x2170 | goto label_17;
| }
0x00002150 sw zero, 0x24(sp) | *(var_24h) = 0;
| label_11:
0x00002154 lw v0, 8(v1) | v0 = *((v1 + 2));
0x00002158 move s0, zero | s0 = 0;
0x0000215c lw v1, 4(v1) | v1 = *((v1 + 1));
0x00002160 bnez v0, 0x2074 |
| } while (v0 != 0);
| label_15:
0x00002164 lw v0, -0x7fdc(gp) | v0 = *((gp - 8183));
0x00002168 addiu v0, v0, 0x33a0 | v0 += 0x33a0;
0x0000216c b 0x2074 | goto label_1;
| label_17:
0x00002170 lw a0, 0x44(sp) | a0 = *(var_44h);
0x00002174 slti v0, a0, 0xa | v0 = (a0 < 0xa) ? 1 : 0;
0x00002178 addiu a0, a0, 2 | a0 += 2;
| if (v0 != 0) {
0x0000217c beqz v0, 0x21dc |
0x00002180 sll a0, a0, 2 | a0 <<= 2;
0x00002184 b 0x1e4c | goto label_2;
| label_8:
0x00002188 move s0, zero | s0 = 0;
0x0000218c b 0x205c | goto label_3;
| label_6:
0x00002190 move s0, zero | s0 = 0;
0x00002194 sw zero, 0x24(sp) | *(var_24h) = 0;
0x00002198 sw zero, 0x28(sp) | *(var_28h) = 0;
0x0000219c b 0x205c | goto label_3;
| label_12:
0x000021a0 lw v1, 0x24(sp) | v1 = *(var_24h);
0x000021a4 lw t9, -0x7ed4(gp) | t9 = sym.imp.g_strconcat;
0x000021a8 sll v0, v0, 2 | v0 <<= 2;
0x000021ac lw a2, 0x2c(sp) | a2 = *(var_2ch);
0x000021b0 addu s0, v1, v0 | s0 = v1 + v0;
0x000021b4 move a3, zero | a3 = 0;
0x000021b8 addiu a1, a1, 0x33e8 | a1 += 0x33e8;
0x000021bc move a0, s7 | a0 = s7;
0x000021c0 jalr t9 | t9 ();
0x000021c4 lw gp, 0x18(sp) | gp = *(var_18h);
0x000021c8 sw v0, (s0) | *(s0) = v0;
0x000021cc lw v0, 0x44(sp) | v0 = *(var_44h);
0x000021d0 addiu v0, v0, 1 | v0++;
0x000021d4 sw v0, 0x44(sp) | *(var_44h) = v0;
0x000021d8 b 0x1f90 | goto label_4;
| }
0x000021dc move s0, zero | s0 = 0;
0x000021e0 sw zero, 0x24(sp) | *(var_24h) = 0;
0x000021e4 b 0x20b0 | goto label_5;
| label_16:
0x000021e8 lw t9, -0x7f44(gp) | t9 = sym.imp.__stack_chk_fail;
0x000021ec jalr t9 | t9 ();
0x000021f0 nop |
| }
[*] Function printf used 2 times customhttpheader.cgi