├── .gitignore ├── LICENSE ├── Makefile ├── README.md └── libleakmydata.c /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.exe 33 | *.out 34 | *.app 35 | *.i*86 36 | *.x86_64 37 | *.hex 38 | 39 | # Debug files 40 | *.dSYM/ 41 | *.su 42 | *.idb 43 | *.pdb 44 | 45 | # Kernel Module Compile Results 46 | *.mod* 47 | *.cmd 48 | .tmp_versions/ 49 | modules.order 50 | Module.symvers 51 | Mkfile.old 52 | dkms.conf 53 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 David Buchanan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS := $(CFLAGS) -fPIC -Wall 2 | CFLAGS := $(CFLAGS) `pkg-config --cflags --libs webkit2gtk-4.0` 3 | 4 | TARGET = libleakmydata 5 | 6 | all: $(TARGET).so 7 | 8 | $(TARGET).so: $(TARGET).o 9 | $(CC) $^ -shared -o $@ 10 | 11 | clean: 12 | rm *.so *.o 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # libleakmydata 2 | 3 | A simple `LD_PRELOAD` library to disable SSL certificate verification. Inspired 4 | by [libeatmydata](https://www.flamingspork.com/projects/libeatmydata/). 5 | 6 | DO NOT USE this if you care about the authenticity or privacy of any data 7 | transmitted over TLS/SSL. 8 | 9 | ### Example usage: 10 | 11 | ``` 12 | $ make 13 | $ LD_PRELOAD=./libleakmydata.so curl https://self-signed.badssl.com/ 14 | ... 15 | ``` 16 | 17 | ### Currently supported libraries: 18 | 19 | - OpenSSL 20 | - GnuTLS 21 | - WebKit2GTK (Tested with Midori and Epiphany browsers) 22 | 23 | Eventually, I'd like to come up with some method of hooking into Firefox/Chrome, 24 | which each use staticly linked SSL libraries. 25 | -------------------------------------------------------------------------------- /libleakmydata.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #define NEXT_HOOK(ret_type, name, args) typedef ret_type (*name##_type) args;\ 9 | name##_type next_##name; \ 10 | ret_type name args { \ 11 | if (next_##name == NULL) { \ 12 | next_##name = (name##_type) dlsym(RTLD_NEXT, #name); \ 13 | } 14 | 15 | 16 | /* OPENSSL HOOKS */ 17 | 18 | void SSL_CTX_set_verify(void *ctx, int mode, void *cb) 19 | { 20 | return; 21 | } 22 | 23 | long SSL_get_verify_result(const void *ssl) 24 | { 25 | return X509_V_OK; 26 | } 27 | 28 | 29 | /* GNUTLS HOOKS */ 30 | 31 | int 32 | gnutls_certificate_verify_peers(gnutls_session_t session, 33 | gnutls_typed_vdata_st * data, 34 | unsigned int elements, 35 | unsigned int *status) 36 | { 37 | *status = 0; 38 | return GNUTLS_E_SUCCESS; 39 | } 40 | 41 | 42 | /* WEBKIT2GTK HOOKS */ 43 | 44 | NEXT_HOOK(WebKitWebContext*, webkit_web_context_get_default, (void)) 45 | //{ 46 | WebKitWebContext* context = next_webkit_web_context_get_default(); 47 | webkit_web_context_set_tls_errors_policy(context, WEBKIT_TLS_ERRORS_POLICY_IGNORE); 48 | return context; 49 | } 50 | 51 | NEXT_HOOK(WebKitWebContext*, webkit_web_context_new, (void)) 52 | //{ 53 | WebKitWebContext* context = next_webkit_web_context_new(); 54 | webkit_web_context_set_tls_errors_policy(context, WEBKIT_TLS_ERRORS_POLICY_IGNORE); 55 | return context; 56 | } 57 | 58 | NEXT_HOOK(void, webkit_web_context_set_tls_errors_policy, 59 | (WebKitWebContext *context, WebKitTLSErrorsPolicy policy)) 60 | //{ 61 | next_webkit_web_context_set_tls_errors_policy(context, WEBKIT_TLS_ERRORS_POLICY_IGNORE); 62 | } 63 | --------------------------------------------------------------------------------