Questions tagged [javascript]

The common name for the language used primarily for scripting in web browsers. It is not related to the Java language. Standardized as ECMAScript, its dialects/implementations include JavaScript and JScript.

Filter by
Sorted by
Tagged with
1 vote
0 answers
83 views

Is checking to see if any parameters contain "__proto___" an effective way to mitigate Prototype Pollution vulnerability?

let key = keys[j] === '' ? (currentParams as any).length : keys[j]; if (key === '__proto__') { throw new Error('Prototype pollution detected.'); } It at least defeats basic url-encoding,...
  • 474
0 votes
2 answers
5k views

read etc/passwd using XSS

by trying the XSS room on THM, I try was trying to read the /etc/passwd using the following cmd: <iframe src="/etc/passwd"></iframe> However what I got is an error code as shown ...
0 votes
0 answers
111 views

What are the security considerations for coding a website with interactive scripts but no backend?

I am developing a simple grammar study website with Bootstrap 5, JQuery and Javascript. It will have interactive grammar quizzes and flashcards. I would like users to be able to type in answers to ...
4 votes
2 answers
362 views

A runtime sometimes converts string arguments (or string returns) from WTF-16 to UTF-16 between functions in a call stack. Is this a security concern?

Suppose that we have this code (in TypeScript syntax): function one(str: string): string { // do something with the string return str } function two() { let s = getSomeString() // returns some ...
  • 71
4 votes
1 answer
332 views

Mitigation for Insecure Deserialization

I'm trying to look for some way for mitigation of insecure deserialization vulnerability for the application front-end Then I found this link https://blog.jscrambler.com/exploring-the-owasp-top-10-by-...
user avatar
-1 votes
1 answer
352 views

What is this obfuscated JS code trying to do? [closed]

I received phishing email that contains base64 encrypted JS code in the attachment. I decrypted it but can't understand it because of obfuscation. Do you guys have any clue what this code is trying to ...
1 vote
0 answers
98 views

Copay cryptocurrency wallet attack: why did hackers rewrite module source file?

There was the notorious attack on the Copay cryptocurrency wallet in 2018. To recap it briefly, the JavaScript based wallet depended on a library, event-stream. Using social engineering, hackers ...
2 votes
2 answers
278 views

About vulnerability in the dependency

I have read many articles about the vulnerability in the program dependency, either direct or transitive. Here are two questions come out of my mind. If a dependency A has a vulnerability (Maybe has ...
  • 153
1 vote
1 answer
466 views

How could I know if a website is fingerprinting you via WebGL?

I would like to know if a website is fingerprinting me via WebGL, first of all, knowing if the site is doing it Knowing when they send the request to my browser Knowing what value I am reporting to ...
  • 111
0 votes
1 answer
303 views

DOM-based XSS - via URL

I have a website that I am testing but I am pretty new to all of this security stuff and would appreciate some help!. I have a url similar to the following: http://testurl?nexturl=whatever The ...
0 votes
1 answer
537 views

How to correctly convert a bit key to string for aes 256 encrytion?

I am using CryptoJS AES 256 encryption: CryptoJS.AES.encrypt(string, secret); The secret is generated through: function generateKey(str) { const salt = CryptoJS.lib.WordArray.random(128 / 8); ...
  • 145
1 vote
2 answers
175 views

Is it insecure for the user to know the process id of a background script on my web server?

I was experiencing an issue on one of my webpages, where an AJAX call is made to another script on the server to generate some files for download. Depending on things like server load, number of files ...
  • 113
0 votes
2 answers
195 views

Is this potential XSS exploitable?

I am pentesting a website and I found that I can inject code at value="" <input type="text" id="search_1" name="keyword" placeholder="Search by keyword&...
  • 21
0 votes
0 answers
128 views

Injection inside double quoted section of script element

For a test to find vulnerabilities I found the following code in a page and I am looking for ways to manipulate it: <script> func({ "key1": "value", "...
  • 1
1 vote
1 answer
1k views

Bypass input validation

I'm trying to create a vulnerable sandbox environment for pentesting challenges. As part of the challenge, I want to include some elements of XSS or SQLi if possible. However, I do not wish to make ...
  • 15
2 votes
0 answers
741 views

Progressive web app, Access token storage

I'm currently working on an existing PWA (Progressive web app) build in VUEJS. Currently i'm using Auth0 for user authentication and it works fine. But it seems a bit overkill and client finds it very ...
0 votes
1 answer
337 views

XSS Payloads: <script> vs javascript:

Hello I was experimenting with XSS payloads and couldn't help wonder the syntax for javascript:alert(0) The most basic payload for XSS makes sense, since the tag is used for JavaScript in HTML. <...
2 votes
0 answers
708 views

Implementing Checkmarx suggested clickjacking fix introduces high severity Client DOM XSS vulnerability

My organization has scanned our code using Checkmarx and the low severity issue Potential Clickjacking on Legacy Browsers was detected due to a JavaScript function firing on an HTML image click event. ...
1 vote
0 answers
234 views

How do you execute payloads with javascript? [closed]

Is it possible to execute payloads with javascript in the browser According to this question you can execute base64 code index.html <html> <script> var encoded = "base64 payload goes ...
12 votes
4 answers
3k views

How does collecting sensitive data using iframes increase security?

So this approach seems to be rather popular, particularly among payment processors that provide javascript integrations. The added layer of security that "fields in iframe" brings also ...
  • 222
0 votes
2 answers
141 views

Safely creating script tag and attaching to DOM

I have a need to to create and attach a script tag to DOM at runtime. The script is a remote webpack bundle (via a Module Federation plugin). I would like to be able to change the URL to that hosted ...
  • 111
1 vote
0 answers
107 views

Webpack chunk loading mechanism and safety

I am trying to understand the mechanics of webpack's chunk loading. From what I understand, chunks are appended to DOM via javascript document.createElement("script") with script's src ...
  • 111
4 votes
3 answers
2k views

Is Firefox's new JavaScript support within PDF files a security concern?

Historically, we have learned that many security vulnerabilities and exploits have resulted from allowing document files to contain executable code, whether it be JavaScript, VBScript, another ...
0 votes
0 answers
3k views

CRSF protection in Next.js applications

So, I am trying to add CSRF protection to my Next.js application. I have tried a development branch of the next-csrf library. I have a couple of questions though: The library saves the CSRF token as ...
-2 votes
1 answer
4k views

how can i find what type of encription this is? im looking for the algorithums and the modes. this is a javascript code [duplicate]

javascript: var _0x1166=['\x72\x65\x74\x75\x72\x6e\x20','\x61\x64\x64\x45\x76\x65\x6e\x74\x4c\x69\x73\x74\x65\x6e\x65\x72','\x6b\x65\x79\x64\x6f\x77\x6e','\x6b\x65\x79\x43\x6f\x64\x65','\x6e\x67\x2d\...
2 votes
3 answers
962 views

Can visiting a website virus your computer if you have JavaScript disabled?

Let's say I visit a website that could potentially infect my computer by just from visiting it. If I disable JavaScript, is it still possible to infect my computer? I have already searched the site ...
2 votes
1 answer
160 views

Is an XSS attack possible under these constraints?

The output is: <img src="http://example.com/[input]" oncontextmenu="openUrl('http://example.com/[input]')"> Where [input] is the user input, which is sanitised through this ...
2 votes
2 answers
2k views

Does escaping quotes in a HTML attribute context prevent XSS?

I'm learning about XSS and I found I can inject code in this tag a few days ago. Tag: <div id="pagenotfound" title='Cannot find /it/search/testtesttesttetst\'onload=alert(1)'> My ...
  • 21
2 votes
1 answer
953 views

Example of script-src-attr that is not already handled by script-src-elem

What would be an example of a CSP script-src-elem directive allowing a script to be loaded but a script-src-attr directive preventing a function in that script from being executed? If you don't want ...
0 votes
0 answers
91 views

Allowing users to add arbitrary JavaScript in published articles

It would be nice if sites like Medium or Substack allowed users to not only add text, images, code snippets, etc., but also custom scripts that allowed readers to run a little piece of code. For ...
0 votes
0 answers
328 views

Global variables accessible to other websites opened in same tab

Today I found a security issue with Chrome (or maybe other browsers I haven't tested yet). What happens is that once you open a site and then open another site in the same tab, the previous site's ...
42 votes
8 answers
28k views

How can I ensure my API is only called by my client?

I have an API Key to a paid service. This API is invoked from an unauthenticated page on my site. I am proxying the request to the paid service through my backend server. I have also added CORS on the ...
0 votes
1 answer
134 views

Can I make javascript think that I'm running on localhost? [closed]

I have a javascript function on a website that I want to attack which is called every time if we log something. So, if we are running on localhost then, window.location.href.substr(7, 9) is "...
  • 1
0 votes
0 answers
163 views

Can a hacker hack my phone by not installing anything on my device?

I know that a device can be compromised by a drive-by download. But could an attacker access my device without installing any malicious app? Can he access my camera by just executing a malicious ...
2 votes
2 answers
181 views

What is the impact and threat of Spectre in Javascript?

If you have looked into this demo of Spectre in JavaScript: Did I get it right that only current site memory can be accessed, due to site isolation etc? I saw there is also an addon to detect attackts ...
  • 947
1 vote
1 answer
880 views

Token Auth best practices: how to prevent copying tokens out of the browser?

I am getting familiar with authentication (using passportjs) and using things like sessions, jet, etc. My question is what is the best way to prevent someone from going on a computer and copying a ...
1 vote
1 answer
279 views

Is it possible for a javascript malware to put keylogger extension in my browser? [duplicate]

I clicked on "It's like you" virus in Facebook Messenger. Then I archived the original link with archive.ph (archive.today), and during the process the site showed me this: https://pastebin....
0 votes
1 answer
209 views

Is it true that frontend validation is generally redundant for minimalist contact forms on minimalist environments?

Say I have a continuously upgraded and well maintained LAMP environment with a website which its CMS is all-core and continuously upgraded as well and I have created a simple backend HTML contact form ...
3 votes
1 answer
3k views

Stored XSS Cookie Stealing - shortest payload

I'm testing a web app (for which I have permissions) and I found a stored XSS vulnerability. It is a little bit tricky to exploit because the input: is being capitalized it has a length constraint of ...
  • 133
0 votes
1 answer
243 views

Can this Javascript redirect be exploited in some way?

Since I can modify pathname, search and hash value could I leverages this in some way? var URL = window.location.hostname+window.location.pathname + window.location.search + window.location.hash; ...
  • 557
1 vote
0 answers
270 views

Is this javascript code malicious? [closed]

a friend visited this site: h-t-t-p-s://adidastore.buzz/adidass/tb.php?_t=1614958342 I malformed the url so no one accidently clicks on it Below is the code the site is serving. I don't know ...
  • 11
1 vote
2 answers
5k views

Is it possible to read and extract HTTP request headers via JavaScript while performing XSS & CSRF? If so, how?

Is it possible to read and extract HTTP request headers via JavaScript? i.e. something like; var req = new XMLHttpRequest(); req.open(‘GET’, document.location, false); req.send(null); var headers = ...
1 vote
1 answer
325 views

Is there a way to check if my site visitor has visited another site?

I want to know if the current visitor has already visited a specific site. The site is owned by someone else and is on a different domain. Is there a way?
  • 13
1 vote
0 answers
138 views

Prevent XSS in 3rd party (self hosted) application

We have an application which have purchased from a 3rd party and host in our own environment. The application consists of its own UI and back-end, and is included in our own application through an ...
0 votes
0 answers
153 views

Can I skip "if" statement with chrome debugger or another javascript debugger?

I see this code in a bug bounty program The code: <!DOCTYPE html> <html> ... </html> <script> if(window.location.pathname === '/' || window.location.pathname.includes('.html')){...
  • 73
3 votes
1 answer
208 views

Are there risks in user-uploaded .txt files sent as a string to PHP

I'm not sure if this question is within the scope of security.stackexchange or it would be more suitable on stackoverflow. Let me know if needed. I'm wetting my feet in PHP, and I've put together a ...
user avatar
0 votes
0 answers
71 views

Libraries or boilerplates providing fundamentals for Public-key generation and encryption of client data?

This may be more suitable for StackOverflow in terms of a recommendation for a library or implementation, but security-related questions are often overlooked or misinterpreted. I'd like to first ...
0 votes
0 answers
103 views

Zero width character causing Javascript runtime error

On a particular page in this application, we have a form which allows for a very select few to input data into it, because at the end of the day (and, well, event loop) we end up wrappping that input ...
  • 123
0 votes
0 answers
30 views

Whats wrong with this XSS vector? [duplicate]

Payload: <DIV STYLE="background-image: url(javascript:alert('XSS'))"> Reference: http://seguretat.wiki.uoc.edu/index.php/XSS_Cheat_Sheet Can someone please explain why this payload is ...
0 votes
1 answer
256 views

how to do a pentest to /assets/js/login.js [closed]

Hey guys this is my first question in this kind of platform. I made a pentest a vulnerable machine this is like a web page video content there are not much target vectors. In my attack a detect only ...
  • 1

1 2
3
4 5
27