Skip to content

Instantly share code, notes, and snippets.

@yehgdotnet
yehgdotnet / smbexec.py
Created August 11, 2020 14:56
smbexec.py with port 443 allowed
#!/usr/bin/env python
# SECUREAUTH LABS. Copyright 2018 SecureAuth Corporation. All rights reserved.
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# A similar approach to psexec w/o using RemComSvc. The technique is described here
# https://www.optiv.com/blog/owning-computers-without-shell-access
# Our implementation goes one step further, instantiating a local smbserver to receive the
@yehgdotnet
yehgdotnet / read-ip-from-file.go
Created August 2, 2020 02:46
Golang Extract IP from file (raw.txt)
package main
import (
"fmt"
"regexp"
"io/ioutil"
"log"
)
func main() {
@yehgdotnet
yehgdotnet / gist:d745d23169d73f14ecf5fbf31f47d23c
Last active May 9, 2020 04:58
JavaScript HTTPS Redirector
<script>
var original_url = window.location.toString();
var https_url = original_url.replace("http://","https://");
if (window.location.toString().indexOf("http://")==0){
location.replace(https_url);
}
</script>
@yehgdotnet
yehgdotnet / gist:d541c60eaa8b6cd9db71e7463ed1bb1c
Last active May 5, 2021 15:07
Tampermonkey filesave dialog
A very fast and easy solution is to use FileSaver.js :
1) Add the following line into the ==UserScript== section of your Greasemonkey script
// @require https://raw.githubusercontent.com/eligrey/FileSaver.js/master/src/FileSaver.js
2) Add the 2 following lines of code to the GM script
var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
saveAs(blob, "hello world.txt");
The most effective control against insecure direct object reference attacks is to avoid exposing internal functionality of the software using a direct object reference that can be easily manipulated.
The following are some defensive strategies that can be taken to accomplish this objective:
■ Use indirect object reference by using an index of the value or a reference map so that direct parameter manipulation is rendered futile unless the attacker also is aware of how the parameter maps to the internal functionality.
■ Do not expose internal objects directly via URLs or form parameters to the end user.
@yehgdotnet
yehgdotnet / common-passwords.txt
Created April 27, 2020 05:57
Common passwords
000000
1q2w3e
1q2w3e4r
1q2w3e4r5t
1qaz2wsx
3rjs1la7qe
18atcskd2w
123
123qwe
1234
1.0.0.1
1.1.1.1
149.112.112.112
2606:4700:4700::1001
2606:4700:4700::1111
2620:fe::9
2620:fe::fe
8.8.4.4
8.8.8.8
9.9.9.9
@yehgdotnet
yehgdotnet / gist:40a640178b1c04eaf8492b95fb90d852
Created April 22, 2020 06:08
java manual code review - source points
\.match|\.contains|\@GetMapping|\@PostMapping|\"matches\"|\@RequestMapping|\@PutMapping|\@DeleteMapping|\@PatchMapping|random|org.springframework.validation|javax.validation|SecretKeyFactory|xmlDecoder|xstream|zip|implements Runnable|implements Threads|new Runnable|new Thread|synchronized|newCachedThreadPool|newFixedThreadPool|utf\-8|403|denied|invalid|illegal|catch \(Exception|System\.loadLibrary|Class\.forName|getRuntime\(\)|AccessController.\doPrivileged|implements Serializable|Object deserialize|deserialize|deserialise|ObjectInputStream|KeyGenerator\.getInstance|printStackTrace|X509TrustManager|SSLContext.getInstance\("SSL"\)|\.hostnameVerifier|new TrustManager|System\.out|System\.err|HttpServletRequest|md5|sha1|password|key|pay|credit|createTempFile|class\.newInstance|.loadClass|.newInstance|objectinputstream.readobject|readObject|Pattern.compile|\.compile|DocumentBuilderFactory|SAXReader
Enable ATS support. Include exception in ATS declaration in the application plist file.
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>exceptionsite.com</key>
<dict>
@yehgdotnet
yehgdotnet / gist:c7de1cd93cda93edd6814b59fd90b088
Last active April 22, 2020 06:05
Hide backgrounding in iOS
While analyzing the source code, look for the fields or screens where sensitive data is involved. Identify if the application sanitize the screen before being backgrounded by using UIImageView.
Possible remediation method that will set a default screenshot:
@property (UIImageView *)backgroundImage;
- (void)applicationDidEnterBackground:(UIApplication *)application {
UIImageView *myBanner = [[UIImageView alloc] initWithImage:@"overlayImage.png"];
self.backgroundImage = myBanner;
[self.window addSubview:myBanner];