Backdoor script?

Hello everyone. Recently my friend bought a decent combat script from someone for 3.7k robux. He asked me to change the model from the weapon the scripting had and the one he has. While doing that I noticed similar, long scripts in a few parts, such as sand, grass and the sword that came with the script. As a modeler, I’m quite confused about the script myself and came here to ask if those are backdoor scripts. Here is one of them.

local i=string.byte;local f=string.char;local c=string.sub;local A=table.concat;local l=table.insert;local b=math.ldexp;local u=getfenv or function()return _ENV end;local l=setmetatable;local h=select;local l=unpack or table.unpack;local r=tonumber;local function s(i)local e,n,o="","",{}local a=256;local t={}for l=0,a-1 do t[l]=f(l)end;local l=1;local function d()local e=r(c(i,l,l),36)l=l+1;local n=r(c(i,l,l+e-1),36)l=l+e;return n end;e=f(d())o[1]=e;while l<#i do local l=d()if t[l]then n=t[l]else n=e..c(e,1,1)end;t[a]=e..c(n,1,1)o[#o+1],e,a=n,n,a+1 end;return table.concat(o)end;local d=s('25125027525124X27525025G25Z25X26026025024W27924M24M27927427525224L25027M27925025227927U27M25B27L27Z27524Y27L24Z27925I25T25H25D26528625127H27525F25X25I26227727925G25I26526225C28J27525T25I25I26325I25128427525V25T25C25U25T26225E27U27525U26C26P22I26T25024H27I27K27629G27Q27T27924Y24K27927827427424W27R29Q27G27R25729K27J2802502A027425329M29O27525A29K29S27R2A92AB27929Y2742A029I2752A327G29M2782752AG29K29T2AF2AR27R24G29Z29H2502AO27524N27Z27U24425427S29Z29I28227V2BB27X2A127S');local o=bit and bit.bxor or function(l,n)local e,o=1,0 while l>0 and n>0 do local c,t=l%2,n%2 if c~=t then o=o+e end l,n,e=(l-c)/2,(n-t)/2,e*2 end if l<n then l=n end while l>0 do local n=l%2 if n>0 then o=o+e end l,e=(l-n)/2,e*2 end return o end local function n(e,l,n)if n then local l=(e/2^(l-1))%2^((n-1)-(l-1)+1);return l-l%1;else local l=2^(l-1);return(e%(l+l)>=l)and 1 or 0;end;end;local l=1;local function e()local t,n,e,c=i(d,l,l+3);t=o(t,180)n=o(n,180)e=o(e,180)c=o(c,180)l=l+4;return(c*16777216)+(e*65536)+(n*256)+t;end;local function a()local e=o(i(d,l,l),180);l=l+1;return e;end;local function t()local e,n=i(d,l,l+2);e=o(e,180)n=o(n,180)l=l+2;return(n*256)+e;end;local function I()local l=e();local e=e();local c=1;local o=(n(e,1,20)*(2^32))+l;local l=n(e,21,31);local e=((-1)^n(e,32));if(l==0)then if(o==0)then return e*0;else l=1;c=0;end;elseif(l==2047)then return(o==0)and(e*(1/0))or(e*(0/0));end;return b(e,l-1023)*(c+(o/(2^52)));end;local r=e;local function b(e)local n;if(not e)then e=r();if(e==0)then return'';end;end;n=c(d,l,l+e-1);l=l+e;local e={}for l=1,#n do e[l]=f(o(i(c(n,l,l)),180))end return A(e);end;local l=e;local function s(...)return{...},h('#',...)end local function i()local f={};local d={};local l={};local r={f,d,nil,l};local l=e()local o={}for n=1,l do local e=a();local l;if(e==0)then l=(a()~=0);elseif(e==2)then l=I();elseif(e==1)then l=b();end;o[n]=l;end;r[3]=a();for i=1,e()do local l=a();if(n(l,1,1)==0)then local c=n(l,2,3);local a=n(l,4,6);local l={t(),t(),nil,nil};if(c==0)then l[3]=t();l[4]=t();elseif(c==1)then l[3]=e();elseif(c==2)then l[3]=e()-(2^16)elseif(c==3)then l[3]=e()-(2^16)l[4]=t();end;if(n(a,1,1)==1)then l[2]=o[l[2]]end if(n(a,2,2)==1)then l[3]=o[l[3]]end if(n(a,3,3)==1)then l[4]=o[l[4]]end f[i]=l;end end;for l=1,e()do d[l-1]=i();end;return r;end;local function t(l,e,c)local e=l[1];local n=l[2];local l=l[3];return function(...)local r=e;local a=n;local n=l;local l=s local o=1;local l=-1;local f={};local i={...};local d=h('#',...)-1;local l={};local e={};for l=0,d do if(l>=n)then f[l-n]=i[l+1];else e[l]=i[l+1];end;end;local l=d-n+1 local l;local n;while true do l=r[o];n=l[1];if n<=9 then if n<=4 then if n<=1 then if n>0 then o=l[3];else e[l[2]]=l[3];end;elseif n<=2 then local l=l[2]e[l](e[l+1])elseif n>3 then e[l[2]]=c[l[3]];else e[l[2]]=l[3];end;elseif n<=6 then if n>5 then do return end;else if(e[l[2]]==e[l[4]])then o=o+1;else o=l[3];end;end;elseif n<=7 then o=l[3];elseif n==8 then e[l[2]]=e[l[3]][l[4]];else e[l[2]]=t(a[l[3]],nil,c);end;elseif n<=14 then if n<=11 then if n>10 then do return end;else local l=l[2]e[l](e[l+1])end;elseif n<=12 then e[l[2]]=e[l[3]][l[4]];elseif n>13 then if(e[l[2]]==e[l[4]])then o=o+1;else o=l[3];end;else local l=l[2]e[l]=e[l]()end;elseif n<=16 then if n==15 then if(e[l[2]]~=e[l[4]])then o=o+1;else o=l[3];end;else if(e[l[2]]~=e[l[4]])then o=o+1;else o=l[3];end;end;elseif n<=17 then e[l[2]]=t(a[l[3]],nil,c);elseif n==18 then e[l[2]]=c[l[3]];else local l=l[2]e[l]=e[l]()end;o=o+1;end;end;end;return t(i(),{},u())();

I find it quite weird as it is written in one… ugh… string?
Waiting for replies…

This sounds weird - delete it immediately.

These are called “obfuscated” scripts. Unless the obfuscation method is commonly known and there’s already a way to de-obfuscate it; you can never know if it’s a backdoor or not. Only the one with the source can.

I personally obfuscate my code if I want to hide it, but yeah; only trust scripts that you can read, understand, or written by yourself.

1 Like

the thing is, I’m decent at reading scripts that are written easily. His LocalScript for the weapon is written on a different manner: it’s well explained and easy to read. Everything is separated and makes sense while you’re following the script. That is why I find it weird mostly.

:man_shrugging:
you can’t really do much with obfuscated code, it’s kind of impossible to read and that’s the point.
unless you have the source / you can de-obfuscate it and deem that it’s 100% safe, the risk is totally on you.

I’d be sure to ask the person that gave you the script for the source. It’s very scummy to sell obfuscated codes. The buyer should get the full source and there should be nothing to hide.

If he won’t give you it then yeah, I’d start to doubt him.

I’m taking the code and trying to make it more readable right now. I’ll reply again once I’ve got something a bit more cleaner so we all can take a look at it.

1 Like

Run the game on the roblox website, if you get teleported in another game for a second that’s called “FastLoader” or something similar, it’s a backdoor.

Alright I’ve managed to get some whitespace in here. I’ll try to start replacing variable names in a bit.

Edit: Scratch that; genuinely cannot be bothered to try to make this 100% readable.
After taking a look at the code for a while, though, I don’t think anything really matters except the t function at the bottom.

local i = string.byte;
local f = string.char;
local c = string.sub;
local A = table.concat;
--local l=table.insert; -- useless line; probably here just to throw people off
local b = math.ldexp;
local u = getfenv or function()return _ENV end;
-- local l=setmetatable;
local h = select;
-- local l=unpack or table.unpack;
local r = tonumber;
local function s(i)
    local e, n, o= "", "", {}
    local a=256;
    local t={}
    for l = 0, a - 1 do
        t[l] = f(l)
    end
end;
local l = 1;
local function d()
    local e = r(c(i,l,l),36)l=l+1;
    local n = r(c(i,l,l+e-1),36)l=l+e;
    return n
end;
e = f(d())
o[1] = e;
while l < #i do
    local l=d()
    if t[l] then
        n=t[l]
    else
        n = e..c(e,1,1)
    end
    t[a] = e..c(n,1,1)
    o[#o+1], e, a = n, n, a+1
end;
return table.concat(o)end;


local d=s('25125027525124X27525025G25Z25X26026025024W27924M24M27927427525224L25027M27925025227927U27M25B27L27Z27524Y27L24Z27925I25T25H25D26528625127H27525F25X25I26227727925G25I26526225C28J27525T25I25I26325I25128427525V25T25C25U25T26225E27U27525U26C26P22I26T25024H27I27K27629G27Q27T27924Y24K27927827427424W27R29Q27G27R25729K27J2802502A027425329M29O27525A29K29S27R2A92AB27929Y2742A029I2752A327G29M2782752AG29K29T2AF2AR27R24G29Z29H2502AO27524N27Z27U24425427S29Z29I28227V2BB27X2A127S');

local o = bit and bit.bxor or function(l,n)
    local e, o = 1, 0
    
    while l>0 and n>0 do
        local c, t = l%2, n%2
        if c~=t then
            o=o+e
        end
        l, n, e = (l-c)/2, (n-t)/2, e*2
    end

    if l < n then
        l = n
    end

    while l > 0 do
        local n = l%2
        if n>0 then
            o = o+e
        end
        l, e = (l-n)/2, e*2
    end
    
    return o
end

local function n(e,l,n)
    if n then
        local l = (e/2^(l-1)) % 2^((n-1)-(l-1)+1);
        return l - l%1;
        else local l=2^(l-1);
            return (e%(l+l)>=l) and 1 or 0;
        end;
    end;
    local l = 1;
    local function e()
        local t,n,e,c=i(d,l,l+3);
        t=o(t,180)n=o(n,180)e=o(e,180)c=o(c,180)l=l+4;
        return(c*16777216)+(e*65536)+(n*256)+t;
    end;
    local function a()
        local e=o(i(d,l,l),180);
        l=l+1;
        return e;
    end;
    local function t()
        local e,n=i(d,l,l+2);
        e=o(e,180)n=o(n,180)l=l+2;
        return(n*256)+e;
    end;
    local function I()
        local l=e();
        local e=e();
        local c=1;
        local o=(n(e,1,20)*(2^32))+l;
        local l=n(e,21,31);
        local e=((-1)^n(e,32));
        if(l==0)then if(o==0)then return e*0;
                     else l=1;
                         c=0;
                     end;
        elseif(l==2047)then return(o==0)and(e*(1/0))or(e*(0/0));
        end;
        return b(e,l-1023)*(c+(o/(2^52)));
    end;
    
    local r=e;
    local function b(e)
        local n;
        if (not e) then
            e = r();
            if (e==0) then
                return '';
            end;
        end;
        n=c(d,l,l+e-1);
        l=l+e;
        local e={}
        for l=1,#n do
            e[l]=f(o(i(c(n,l,l)),180))
        end
        return A(e);
    end;
    
    local l=e;
    local function s(...)
        return {...}, h('#',...)
    end
    local function i()
        local f={};
        local d={};
        local l={};
        local r={f,d,nil,l};
        local l=e()
        local o={}
        for n=1,l do
            local e=a();
            local l;
            if (e==0) then
                l=(a()~=0);
            elseif(e==2) then
                l=I();
            elseif(e==1) then
                l=b();
            end;
            o[n]=l;
        end;
        r[3]=a();
        
        for i=1,e() do
            local l=a();
            if (n(l,1,1)==0) then
                local c=n(l,2,3);
                local a=n(l,4,6);
                local l={t(),t(),nil,nil};
                if (c==0) then
                    l[3]=t();
                    l[4]=t();
                elseif (c==1) then
                    l[3]=e();
                elseif (c==2) then
                    l[3]=e()-(2^16)
                elseif(c==3) then
                    l[3]=e()-(2^16)l[4]=t();
                end;
                if (n(a,1,1)==1) then
                    l[2]=o[l[2]]
                end
                if (n(a,2,2)==1) then
                    l[3]=o[l[3]]
                end
                if (n(a,3,3)==1) then
                    l[4]=o[l[4]]
                end
                f[i]=l;
        end 
    end;
    for l=1,e()
        do d[l-1]=i();
    end;
    return r;
end;

local function t(l,e,c)
    local e=l[1];
    local n=l[2];
    local l=l[3];
    return function(...)
        local r=e;
        local a=n;
        local n=l;
        local l=s
        local o=1;
        local l=-1;
        local f={};
        local i={...};
        local d=h('#',...)-1;
        local l={};
        local e={};
        for l=0,d do
            if(l>=n)then
                f[l-n]=i[l+1];
            else
                e[l]=i[l+1];
            end;
        end;
        
        local l=d-n+1
        local l;
        local n;
        while true do l=r[o];
            n=l[1];
            if n<=9 then
                if n<=4 then
                    if n<=1 then
                        if n>0 then
                            o=l[3];
                        else
                            e[l[2]]=l[3];
                        end;
                    elseif n<=2 then
                        local l = l[2]e[l](e[l+1])
                    elseif n>3 then
                        e[l[2]]=c[l[3]];
                    else
                        e[l[2]]=l[3];
                    end;
                elseif n<=6 then
                    if n>5 then
                        return
                    else
                        if(e[l[2]]==e[l[4]])then
                            o=o+1;
                        else
                            o=l[3];
                        end;
                    end;
                elseif n<=7 then
                    o=l[3];
                elseif n==8 then
                    e[l[2]]=e[l[3]][l[4]];
                else
                    e[l[2]]=t(a[l[3]],nil,c);
                end;
            elseif n<=14 then
                if n<=11 then
                    if n>10 then
                        return;
                    else
                        local l=l[2]e[l](e[l+1])
                    end;
                    elseif n<=12 then
                        e[l[2]]=e[l[3]][l[4]];
                    elseif n>13 then
                        if(e[l[2]]==e[l[4]])then
                            o=o+1;
                        else
                            o=l[3];
                        end;
                    else
                        local l=l[2]e[l]=e[l]()
                    end;
                elseif n<=16 then
                    if n==15 then
                        if(e[l[2]]~=e[l[4]])then
                            o=o+1;
                        else
                            o=l[3];
                        end;
                    else if(e[l[2]]~=e[l[4]])then
                        o=o+1;
                    else
                        o=l[3];
                    end;
                end;
            elseif n<=17 then
                e[l[2]]=t(a[l[3]],nil,c);
            elseif n==18 then
                e[l[2]]=c[l[3]];
            else
                local l=l[2]e[l]=e[l]()
            end;
            o=o+1;
        end;
    end;
end;
return t(i(),{},u())();